######################################################################## ## DESCRIPTION ## A WeBWorK problem that asks students to construct a confidence interval ## given the population standard deviation and answer questions on it. ## WeBWorK problem written by JoAnne Taormina, ## ENDDESCRIPTION ## ## KEYWORDS('confidence interval', 'population standard deviation', 'z-score') ## ## Author('JoAnne Taormina') ## Institution('Nassau Community College') ######################################################################## DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGgraphmacros.pl", "weightedGrader.pl", "PGunion.pl", "parserMultiAnswer.pl", "PGcourse.pl", "PGchoicemacros.pl", ); # make sure we're in the context we want Context("Numeric"); $xbar = random(70, 100, 1); $pop_stnd_dev = random(3, 7, .0001); $n = random(35, 55, 1); $sqrt_n = sqrt($n); $z90 = 1.65; $z99 = 2.58; $conf90_int_low = $xbar - $z90*($pop_stnd_dev/sqrt($n)); # round $conf90_int_low to 2 decimal places $conf90_int_low = int(100*$conf90_int_low+.5*($conf90_int_low <=> 0))/100; $conf90_int_high = $xbar + $z90*($pop_stnd_dev/sqrt($n)); # round $conf90_int_high to 2 decimal places $conf90_int_high = int(100*$conf90_int_high+.5*($conf90_int_high <=> 0))/100; $me = ($conf90_int_high - $conf90_int_low)/2; # round $me to 2 decimal places $me = int(100*$me+.5*($me <=> 0))/100; $conf99_int_low = $xbar - $z99*($pop_stnd_dev/sqrt($n)); # round $conf99_int_low to 2 decimal places $conf99_int_low = int(100*$conf99_int_low+.5*($conf99_int_low <=> 0))/100; $conf99_int_high = $xbar + $z99*($pop_stnd_dev/sqrt($n)); # round $conf99_int_high to 2 decimal places $conf99_int_high = int(100*$conf99_int_high+.5*($conf99_int_high <=> 0))/100; $xbar = Compute($xbar); $pop_stnd_dev = Compute($pop_stnd_dev); $sqrt_n = Compute($sqrt_n); $z90 = Compute($z90); $z99 = Compute($z99); $conf90_int_low = Compute($conf90_int_low); $conf90_int_high = Compute($conf90_int_high); $conf99_int_low = Compute($conf99_int_low); $conf99_int_high = Compute($conf99_int_high); $me = Compute($me); $choice_a = "There is a 1% chance that the sample mean golf score for a sample of $n golfers is not in the interval found in part (e)."; $choice_b = "We are 99% confident that the true population mean golf score for all golfers lies in the interval found in part (e)."; $choice_c = "We are 99% confident that the sample mean golf score for a sample of $n golfers lies in the interval found in part (e)."; $choice_d = "The true population mean golf score for all golfers lies in the interval found in part (e)."; # set up for a multiple choice problem. $radio_conf_int = new_multiple_choice(); $radio_conf_int->qa("What is the correct interpretation of the confidence interval found in part (e)?", $choice_b); $radio_conf_int->extra($choice_a, $choice_c, $choice_d); Context()->texStrings; $showformula = ColumnTable( ColumnTable( ans_rule(5)." - ".ans_rule(5), ans_rule(5).$BR.$HR.ans_rule(5), indent => 0, separation => 10, valign => "MIDDLE" ), ColumnTable( "to".$SPACE.$SPACE.$SPACE.$SPACE.$SPACE.$SPACE.$SPACE.ans_rule(5)." + ".ans_rule(5), ans_rule(5).$BR.$HR.ans_rule(5), indent => 0, separation => 10, valign => "MIDDLE"), indent => 0, separation => 10, valign => "MIDDLE"); $showformula2 = ColumnTable( ColumnTable( ans_rule(5)." - ".ans_rule(5), ans_rule(5).$BR.$HR.ans_rule(5), indent => 0, separation => 10, valign => "MIDDLE" ), ColumnTable( "to".$SPACE.$SPACE.$SPACE.$SPACE.$SPACE.$SPACE.$SPACE.ans_rule(5)." + ".ans_rule(5), ans_rule(5).$BR.$HR.ans_rule(5), indent => 0, separation => 10, valign => "MIDDLE"), indent => 0, separation => 10, valign => "MIDDLE"); TEXT(beginproblem()); Context()->texStrings; BEGIN_TEXT Use the following information for all parts: $BR On a particular golf course, a sample of $n golfers have a mean golf score of $xbar. Suppose the population standard deviation for this course is $pop_stnd_dev. $BR $BR (a) Using the formula a $BBOLD 90% confidence interval $EBOLD as presented in lecture, fill in the blanks with the appropriate values for this problem for calculating the confidence interval below. To enter \( \sqrt x \) where x is any number, type sqrt(x). For example, \( \sqrt 2 \) should be typed as sqrt(2). $BR $BR $BCENTER $showformula $ECENTER $BR $BR (b) Using the formula from part (a), find a $BBOLD 90% confidence interval $EBOLD for the mean golf score of all golfers. Round each answer to the nearest hundredth (2 decimal places). $BR $BR $BCENTER \{ ans_rule(5) \} to \{ ans_rule(5) \} $ECENTER $BR $BR (c) Calculate the margin of error for the answer in part (b). Round the answer to the nearest hundredth (2 decimal places). $BR $BR $BCENTER \{ ans_rule(5) \} $ECENTER $BR $BR (d) Using the formula a $BBOLD 99% confidence interval $EBOLD as presented in lecture, fill in the blanks with the appropriate values for this problem for calculating the confidence interval below. To enter \( \sqrt x \) where x is any number, type sqrt(x). For example, \( \sqrt 2 \) should be typed as sqrt(2). $BR $BR $BCENTER $showformula2 $ECENTER $BR $BR (e) Using the formula from part (d), find a $BBOLD 99% confidence interval $EBOLD for the mean golf score of all golfers. Round each answer to the nearest hundredth (2 decimal places). $BR $BR $BCENTER \{ ans_rule(5) \} to \{ ans_rule(5) \} $ECENTER $BR $BR (f) \{ $radio_conf_int->print_q() \} \{ $radio_conf_int->print_a() \} $BR$BR END_TEXT Context()->normalStrings; Context("Numeric"); WEIGHTED_ANS($xbar->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($z90->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($pop_stnd_dev->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($sqrt_n->cmp(tolType=>'absolute',tolerance=>.0001), 3); WEIGHTED_ANS($xbar->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($z90->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($pop_stnd_dev->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($sqrt_n->cmp(tolType=>'absolute',tolerance=>.0001), 3); WEIGHTED_ANS($xbar->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($z99->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($pop_stnd_dev->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($sqrt_n->cmp(tolType=>'absolute',tolerance=>.0001), 3); WEIGHTED_ANS($xbar->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($z99->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($pop_stnd_dev->cmp(tolType=>'absolute',tolerance=>0), 2); WEIGHTED_ANS($sqrt_n->cmp(tolType=>'absolute',tolerance=>.0001), 3); WEIGHTED_ANS($conf90_int_low->cmp(tolType=>'absolute',tolerance=>.02), 10); WEIGHTED_ANS($conf90_int_high->cmp(tolType=>'absolute',tolerance=>.02), 10); WEIGHTED_ANS($me->cmp(tolType=>'absolute',tolerance=>0), 12); WEIGHTED_ANS($conf99_int_low->cmp(tolType=>'absolute',tolerance=>.02), 10); WEIGHTED_ANS($conf99_int_high->cmp(tolType=>'absolute',tolerance=>.02), 10); WEIGHTED_ANS( radio_cmp( $radio_conf_int->correct_ans() ), 12 ); ENDDOCUMENT();