######################################################################## ## DESCRIPTION ## A WeBWorK problem that asks students to find the mean and standard deviation of a ## data set, and convert raw scores to z-scores and z-scores to raw scores. ## WeBWorK problem written by JoAnne Taormina, ## ENDDESCRIPTION ## ## KEYWORDS('mean', 'standard deviation', 'raw score', 'z-score', 'formula') ## ## 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 < 10; $i ++) { $data[$i] = random(10, 90, 1); $mean += $data[$i]; } $mean = $mean / 10; $mean = sprintf("%0.2f",$mean); # set up for a multiple choice problem. $radio_mean = new_multiple_choice(); $radio_mean->qa("The correct symbol for the mean for this data set is ", "\( \bar{x} \)"); $radio_mean->extra("\( \mu \)", "\( \sigma \)", "\( s \)"); for($i = 0; $i<10; $i++) { $stnd_dev = $stnd_dev + (($data[$i] - $mean)**2); } $stnd_dev = sqrt($stnd_dev / 9); $stnd_dev = sprintf("%0.4f",$stnd_dev); # set up for a multiple choice problem. $radio_stnd_dev = new_multiple_choice(); $radio_stnd_dev->qa("The correct symbol for the standard deviation for this data set is ", "\( s \)"); $radio_stnd_dev->extra("\( \mu \)", "\( \sigma \)", "\( \bar{x} \)"); $part_c_ans = ($data[0] - $mean)/$stnd_dev; $part_c_ans = sprintf("%0.2f",$part_c_ans); $part_c_ans = Compute($part_c_ans); $part_d_ans = ($data[9] - $mean)/$stnd_dev; $part_d_ans = sprintf("%0.2f",$part_d_ans); $part_d_ans = Compute($part_d_ans); $part_e = random(1, 3, .01); $part_e_ans = $mean + ($part_e*$stnd_dev); $part_e_ans = sprintf("%0.2f",$part_e_ans); $part_e_ans = Compute($part_e_ans); $part_f = random(1, 3, .01); $part_f_ans = $mean - ($part_f*$stnd_dev); $part_f_ans = sprintf("%0.2f",$part_f_ans); $part_f_ans = Compute($part_f_ans); $part_g_ans = $mean; $part_g_ans = Compute($part_g_ans); $mean = Compute($mean); $stnd_dev = Compute($stnd_dev); TEXT(beginproblem()); Context()->texStrings; BEGIN_TEXT Suppose the following are a sample of data values taken from a larger population of scores. $BR $BR $BCENTER \[ $data[0], \ $data[1], \ $data[2], \ $data[3], \ $data[4], \ $data[5], \ $data[6], \ $data[7], \ $data[8], \ $data[9] \] $BR$BR $ECENTER (a) Find the mean of the data set. Round to the nearest hundredth (2 decimal places). $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (b) \{ $radio_mean->print_q() \} \{ $radio_mean->print_a() \} $BR$BR (c) Find the standard deviation of the data set. Round to 4 decimal places. $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (d) \{ $radio_stnd_dev->print_q() \} \{ $radio_stnd_dev->print_a() \} $BR$BR Using the answers to parts (a) and (c), answer the following questions. $BR (e) Calculate the z-score for the raw score of \{ $data[0] \}. Round to 2 decimal places (nearest hundredth). $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (f) Find the z-score for the raw score \{ $data[9] \}. Round to 2 decimal places (nearest hundredth). $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (g) Find the data value (i.e. raw-score) that has a z-score of \{ $part_e \}. Round to 2 decimal places (nearest hundredth). $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (h) Find the data value (i.e. raw-score) that is \{ $part_f \} standard deviations $BBOLD below $EBOLD the mean. Round to 2 decimal places (nearest hundredth). $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER (i) Find the data value (raw-score) that has a z-score of 0. $BR $BR $BCENTER \{ ans_rule(5) \} $BR $BR $ECENTER $ECENTER END_TEXT Context("Numeric"); WEIGHTED_ANS( $mean->cmp(tolType=>'absolute',tolerance=>0), 15 ); WEIGHTED_ANS( radio_cmp( $radio_mean->correct_ans() ), 5 ); WEIGHTED_ANS( $stnd_dev->cmp(tolType=>'absolute',tolerance=>0), 15 ); WEIGHTED_ANS( radio_cmp( $radio_stnd_dev->correct_ans() ), 5 ); WEIGHTED_ANS( $part_c_ans->cmp(tolType=>'absolute',tolerance=>0.01), 12 ); WEIGHTED_ANS( $part_d_ans->cmp(tolType=>'absolute',tolerance=>0.01), 12 ); WEIGHTED_ANS( $part_e_ans->cmp(tolType=>'absolute',tolerance=>0.01), 12 ); WEIGHTED_ANS( $part_f_ans->cmp(tolType=>'absolute',tolerance=>0.01), 12 ); WEIGHTED_ANS( $part_g_ans->cmp(tolType=>'absolute',tolerance=>0.01), 12 ); ENDDOCUMENT();