[npl] / trunk / NationalProblemLibrary / UVA-Stat / setStat212-Homework11 / stat212-HW11-10.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Annotation of /trunk/NationalProblemLibrary/UVA-Stat/setStat212-Homework11/stat212-HW11-10.pg

 1 : jjholt 451 ##DESCRIPTION 2 : ##KEYWORDS('statistics','Inference about a population') 3 : ## 4 : ## CMMK tagged this problem 5 : 6 : ## DBchapter('Inference About a Population') 7 : ## DBsection() 8 : ## Date('07/12/2005') 9 : ## Author('Cristina Murray-Krezan') 10 : ## Institution('UVa') 11 : ## TitleText1('Statistics for Management and Economics, Abbr. 6th edition') 12 : ## EditionText1('6') 13 : ## AuthorText1('Keller & Warrack') 14 : ## Section1() 15 : ## Problem1() 16 : 17 : 18 : ##ENDDESCRIPTION 19 : 20 : DOCUMENT(); # This should be the first executable line in the problem. 21 : 22 : loadMacros( 23 : "PG.pl", 24 : "PGbasicmacros.pl", 25 : "PGchoicemacros.pl", 26 : "PGanswermacros.pl", 27 : "PGgraphmacros.pl", 28 : "PGnumericalmacros.pl", 29 : "PGstatisticsmacros.pl", 30 : "extraAnswerEvaluators.pl" 31 : ); 32 : 33 : TEXT(beginproblem()); 34 : $showPartialCorrectAnswers = 0; 35 : install_problem_grader(~~&std_problem_grader); 36 : 37 :$pval = 0; 38 : while ($pval < 0.005) { 39 : 40 :$mu1 = random(63,68,1); 41 : $mu2 = random(73,78,1); 42 : 43 :$p1[1] = $mu1 + random(-5,5,1); 44 :$p1[2] = $mu1 + random(-5,5,1); 45 :$p1[3] = $mu1 + random(-5,5,1); 46 :$p1[4] = $mu1 + random(-5,5,1); 47 :$p1[5] = $mu1 + random(-5,5,1); 48 :$p1[6] = $mu1 + random(-5,5,1); 49 :$p1[7] = $mu1 + random(-5,5,1); 50 :$n1 = 7; 51 : 52 : $p2[1] =$mu2 + random(-5,5,1); 53 : $p2[2] =$mu2 + random(-5,5,1); 54 : $p2[3] =$mu2 + random(-5,5,1); 55 : $p2[4] =$mu2 + random(-5,5,1); 56 : $p2[5] =$mu2 + random(-5,5,1); 57 : $p2[6] =$mu2 + random(-5,5,1); 58 : $p2[7] =$mu2 + random(-5,5,1); 59 : $p2[8] =$mu2 + random(-5,5,1); 60 : $n2 = 8; 61 : 62 :$xbar1 = ($p1[1]+$p1[2]+$p1[3]+$p1[4]+$p1[5]+$p1[6]+$p1[7])/$n1; 63 : $xbar2 = ($p2[1]+$p2[2]+$p2[3]+$p2[4]+$p2[5]+$p2[6]+$p2[7]+$p2[8])/$n2; 64 : $s1 = sqrt( (($p1[1]-$xbar1)**2 + ($p1[2]-$xbar1)**2 + ($p1[3]-$xbar1)**2 + 65 : ($p1[4]-$xbar1)**2 + ($p1[5]-$xbar1)**2 + ($p1[6]-$xbar1)**2 + 66 : ($p1[7]-$xbar1)**2)/($n1-1)); 67 : $s2 = sqrt( (($p2[1]-$xbar2)**2 + ($p2[2]-$xbar2)**2 + ($p2[3]-$xbar2)**2 + 68 : ($p2[4]-$xbar2)**2 + ($p2[5]-$xbar2)**2 + ($p2[6]-$xbar2)**2 + 69 : ($p2[7]-$xbar2)**2 + ($p2[8]-$xbar2)**2)/($n2-1)); 70 : 71 : $df =$n1 + $n2 - 2; 72 :$sp2 = (($n1-1)*$s1**2 + ($n2-1)*$s2**2)/$df; 73 : 74 :$alpha = random(0.02, 0.08, 0.005); 75 : 76 : $tstat = ($xbar1 - $xbar2)/sqrt($sp2*(1/$n1 + 1/$n2)); 77 : $tcrit = tdistr($df,$alpha); 78 :$pval = tprob($df,-$tstat); 79 : } 80 : 81 : $mc = new_multiple_choice(); 82 : 83 : @ans = ("Reject $$H_0$$.", "Do Not Reject $$H_0$$.", 84 : "Reject $$H_1$$.", "Do Not Reject $$H_1$$."); 85 : 86 : if ($pval < $alpha) {$tag = 0;} else {$tag = 1;} 87 : 88 :$mc -> qa('D. Your decision for the hypothesis test:', $ans[$tag]); 89 : 90 : $mc -> extra($ans[1-$tag],$ans[2],$ans[3]); 91 : 92 : 93 : BEGIN_TEXT 94 :$PAR 95 : Random samples of resting heart rates are taken from two groups. 96 : Population 1 exercises regularly, and Population 2 does not. The data 97 : from these two samples is given below: 98 : $PAR 99 : 100 : Population 1:$p1[1], $p1[2],$p1[3], $p1[4],$p1[5], $p1[6],$p1[7] 101 : 102 : $PAR 103 : 104 : Population 2:$p2[1], $p2[2],$p2[3], $p2[4],$p2[5], $p2[6],$p2[7], $p2[8] 105 : 106 :$PAR 107 : 108 : Is there evidence, at an $$\alpha = alpha$$ level of significance, 109 : to conclude that there those who exercise regularly have lower resting heart 110 : rates? (Assume that the population variances are equal.) Carry out an appropriate 111 : hypothesis test, filling in the information requested. 112 : $PAR 113 : 114 : A. The value of the standardized test statistic: \{ ans_rule(25) \} 115 :$PAR 116 : $BBOLD Note:$EBOLD For the next part, your answer should use interval notation. An 117 : answer of the form $$(-\infty, a)$$ is expressed (-infty, a), an answer of the 118 : form $$(b, \infty)$$ is expressed (b, infty), and an answer of the 119 : form $$(-\infty, a) \cup (b, \infty)$$ is expressed (-infty, a)U(b, infty). 120 : $PAR 121 : B. The rejection region for the standardized test statistic: \{ ans_rule(25) \}$PAR 122 : $PAR 123 : C. The p-value is \{ ans_rule(25) \}$PAR 124 : 125 : \{ $mc ->print_q() \}$BR 126 : \{ $mc ->print_a() \} 127 : 128 : END_TEXT 129 : 130 : ANS(num_cmp($tstat)); 131 : ANS(interval_cmp("(-infty,-$tcrit)", sloppy=>'yes')); 132 : ANS(num_cmp($pval,tol=>0.005)); 133 : ANS(radio_cmp(\$mc->correct_ans)); 134 : 135 : ENDDOCUMENT(); # This should be the last executable line in the problem.