######################################################################## ## DESCRIPTION ## A WeBWorK problem that asks students to answer questions on a sampling distribution. ## WeBWorK problem written by JoAnne Taormina, ## ENDDESCRIPTION ## ## KEYWORDS('sampling distribution', 'standard error', 'sample error', 'mean of the sampling distribution') ## ## Author('JoAnne Taormina') ## Institution('Nassau Community College') ######################################################################## DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGgraphmacros.pl", "weightedGrader.pl", "PGchoicemacros.pl", ); install_weighted_grader(); # make sure we're in the context we want Context("Numeric"); # the data @data = (); $mean=0; for($i = 0; $i < 5; $i ++) { $data[$i] = random(10, 90, 1); $mean += $data[$i]; } $mean = $mean / 5; # round $mean to 4 decimal places $mean = int(10000*$mean+.5*($mean <=> 0))/10000; $mean_ans = Compute($mean); $stnd_dev = 0; for($i = 0; $i<5; $i++) { $stnd_dev = $stnd_dev + (($data[$i] - $mean)**2); } $stnd_dev = sqrt($stnd_dev / 5); # round $stnd_dev to 4 decimal places $stnd_dev = int(10000*$stnd_dev+.5*($stnd_dev <=> 0))/10000; $stnd_dev_ans = Compute($stnd_dev); # set up for a multiple choice problem. $radio_samp_dist = new_multiple_choice(); $radio_samp_dist->qa("What is the collection of data values in the second column, 'sample means,' called?", "Sampling distribution of means"); $radio_samp_dist->extra("Sampling error of the means", "Standard error of the means", "Distribution of standard errors", "Mean of the sampling distribution"); # set up for a multiple choice problem. $radio_sampl_dist_mean_symbol = new_multiple_choice(); $radio_sampl_dist_mean_symbol->qa("What is symbol associated with the value in part (f)?", "\( \mu_{\bar{x}} \)"); $radio_sampl_dist_mean_symbol->extra("\( \mu \)", "\( \sigma \)", "\( \bar{x} \)", "\( \sigma_{\bar{x}} \)"); # set up for a multiple choice problem. $radio_stnd_error_symbol = new_multiple_choice(); $radio_stnd_error_symbol->qa("What is symbol associated with the value in part (h)?", "\( \sigma_{\bar{x}} \)" ); $radio_stnd_error_symbol->extra("\( \mu \)", "\( \sigma \)", "\( \bar{x} \)", "\( \mu_{\bar{x}} \)"); # the table data $table_start = begintable(3); $table_row[0] = row( "Samples of Size n=2", "Sample Means", "Sampling Errors"); $table_row[1] = row( $data[0].", ".$data[1], ans_rule(5), ans_rule(5)); $table_row[2] = row( $data[0].", ".$data[2], ans_rule(5), ans_rule(5)); $table_row[3] = row( $data[0].", ".$data[3], ans_rule(5), ans_rule(5)); $table_row[4] = row( $data[0].", ".$data[4], ans_rule(5), ans_rule(5)); $table_row[5] = row( $data[1].", ".$data[2], ans_rule(5), ans_rule(5)); $table_row[6] = row( $data[1].", ".$data[3], ans_rule(5), ans_rule(5)); $table_row[7] = row( $data[1].", ".$data[4], ans_rule(5), ans_rule(5)); $table_row[8] = row( $data[2].", ".$data[3], ans_rule(5), ans_rule(5)); $table_row[9] = row( $data[2].", ".$data[4], ans_rule(5), ans_rule(5)); $table_row[10] = row( $data[3].", ".$data[4], ans_rule(5), ans_rule(5)); $table_end = endtable(); @sample_means = (); $sample_means[0]=($data[0]+$data[1])/2; $sample_means[1]=($data[0]+$data[2])/2; $sample_means[2]=($data[0]+$data[3])/2; $sample_means[3]=($data[0]+$data[4])/2; $sample_means[4]=($data[1]+$data[2])/2; $sample_means[5]=($data[1]+$data[3])/2; $sample_means[6]=($data[1]+$data[4])/2; $sample_means[7]=($data[2]+$data[3])/2; $sample_means[8]=($data[2]+$data[4])/2; $sample_means[9]=($data[3]+$data[4])/2; @sampling_errors = (); for($i=0; $i<10;$i++) { $sampling_errors[$i]=$sample_means[$i]-$mean; $sample_means[$i]=Compute($sample_means[$i]); $sampling_errors[$i]=Compute($sampling_errors[$i]); } $stnd_error = $stnd_dev/sqrt(2)*sqrt(3/4); # round $stnd_error to 4 decimal places $stnd_error = int(10000*$stnd_error+.5*($stnd_error <=> 0))/10000; $stnd_error = Compute($stnd_error); TEXT(beginproblem()); Context()->texStrings; BEGIN_TEXT Consider a population of 5 literature students. Each student was assigned a final paper assignment. For each student (S1 for student 1, S2 for student 2, etc.), the number of pages the student wrote for his or her paper is listed below: $BR $BR $BCENTER \[ S1 = $data[0], \ S2 = $data[1], \ S3 = $data[2], \ S4 = $data[3], \ S5 = $data[4] \] $BR $ECENTER (a) Find the mean of the population. Round to 4 decimal places if necessary. $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (b) Find the standard deviation of the population. Round to 4 decimal places if necessary. $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (c)All the possible samples of size n=2 is listed in the first column of the table below. For all the possible samples, calculate the sample mean and put that value in the second column. Do not round any quantities. $BR $BR (d) For all the possible samples, calculate the sampling error, and put that value in the third column. $BR $BR $BCENTER $table_start $table_row[0] $table_row[1] $table_row[2] $table_row[3] $table_row[4] $table_row[5] $table_row[6] $table_row[7] $table_row[8] $table_row[9] $table_row[10] $table_end $BR $BR $ECENTER (e) \{ $radio_samp_dist->print_q() \} \{ $radio_samp_dist->print_a() \} $BR$BR (f) Calculate the mean of the data values in the second column of the table. $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (g) \{ $radio_sampl_dist_mean_symbol->print_q() \} \{ $radio_sampl_dist_mean_symbol->print_a() \} $BR $BR (h) Using your answer from part (b) calculate the standard error, using the finite correction factor. Round to 4 places if necessary. $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (i) \{ $radio_stnd_error_symbol->print_q() \} \{ $radio_stnd_error_symbol->print_a() \} $BR $BR END_TEXT Context("Numeric"); for($i = 0; $i < 10; $i++) { WEIGHTED_ANS( $sample_means[$i]->cmp(tolType=>'absolute',tolerance=>0.001), 2 ); WEIGHTED_ANS( $sampling_errors[$i]->cmp(tolType=>'absolute',tolerance=>0.001), 2 ); } WEIGHTED_ANS( $mean_ans->cmp(tolType=>'absolute',tolerance=>0), 8 ); WEIGHTED_ANS( $stnd_dev_ans->cmp(tolType=>'absolute',tolerance=>0), 8 ); WEIGHTED_ANS( radio_cmp( $radio_samp_dist->correct_ans() ), 8 ); WEIGHTED_ANS( $mean_ans->cmp(tolType=>'absolute',tolerance=>0), 10 ); WEIGHTED_ANS( radio_cmp( $radio_sampl_dist_mean_symbol->correct_ans() ), 8 ); WEIGHTED_ANS( $stnd_error->cmp(tolType=>'absolute',tolerance=>0), 10 ); WEIGHTED_ANS( radio_cmp( $radio_stnd_error_symbol->correct_ans() ), 8 ); ENDDOCUMENT();