[rochester] / trunk / rochester_problib / setStatistics4HypothesisTesting / ur_stt_4_17a.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/rochester_problib/setStatistics4HypothesisTesting/ur_stt_4_17a.pg

Tue Jul 3 20:44:12 2001 UTC (11 years, 10 months ago) by maria
File size: 3200 byte(s)
various corrections and modifications


    1 ##DESCRIPTION
2 ##KEYWORDS('hypothesis testing','population proportion','statistics')
3 ##
4 ##ENDDESCRIPTION
5
6 DOCUMENT();        # This should be the first executable line in the problem.
7
9 "PG.pl",
10 "PGbasicmacros.pl",
11 "PGchoicemacros.pl",
13 "PGnumericalmacros.pl",
14 "PGstatisticsmacros.pl",
15 "PGauxiliaryFunctions.pl"
16 );
17
18 TEXT(beginproblem());
19 $showPartialCorrectAnswers = 1; 20 21$n = random(90,150,10);
22 $phat = random(.60,.80,.01); 23 24 for ($i=0; $i<3;$i++) {
25   $p[$i] = random(.50,.70,.05);
26   $a[$i] = random(.01,.05,.04);
27   $q[$i] = 1-$p[$i];
28   $sd[$i] = sqrt ($p[$i]*$q[$i]/$n); 29$z[$i] = ($phat-$p[$i])/$sd[$i];
30 }
31 for ($i=0;$i<2; $i++) { 32$t[$i] = udistr($a[$i]); 33 } 34$t[2] = udistr(($a[2]/2)); 35 if ($z[0] > $t[0] ) {$tag1 = 0;} else {$tag1 = 1;} 36 if ($z[1] < -$t[1]) {$tag2 = 0;} else {$tag2 = 1;} 37 if ($z[2] < -$t[2] or$z[2] > $t[2]) {$tag3 = 0;} else {$tag3 = 1;} 38$mc1 = new_multiple_choice();
39
40 @ans1 = ("We can reject the null hypothesis that $$p = p[0]$$ and accept that $$p > p[0]$$. ",
41         "There is not sufficient evidence to reject the null hypothesis that $$p = p[0]$$. ");
42
43 $mc1 -> qa('The final conclustion is',$ans1[$tag1]); 44 45$mc1 -> extra($ans1[1-$tag1]);
46
47 $mc2 = new_multiple_choice(); 48 49 @ans2 = ("We can reject the null hypothesis that $$p = p[1]$$ and accept that $$p < p[1]$$. ", 50 "There is not sufficient evidence to reject the null hypothesis that $$p = p[1]$$. "); 51 52$mc2 -> qa('The final conclustion is', $ans2[$tag2]);
53
54 $mc2 -> extra($ans2[1-$tag2]); 55 56$mc3 = new_multiple_choice();
57
58 @ans3 = ("We can reject the null hypothesis that $$p = p[2]$$ and accept that $$p \ne p[2]$$. ",
59         "There is not sufficient evidence to reject the null hypothesis that $$p = p[2]$$. ");
60
61 $mc3 -> qa('The final conclustion is',$ans3[$tag3]); 62 63$mc3 -> extra($ans3[1-$tag3]);
64
65 BEGIN_TEXT
66 A random sample of $$n$$ observations is selected from a binomial population with unknown
67 probability of success $$p$$.  The computed value of $$\hat{p}$$ is $$phat$$.
68 $BR 69 (1) $$\$$ Test $$H_0: p = p[0]$$ against $$H_a: p > p[0]$$. Use $$\alpha = a[0]$$.$PAR
70 test statistic $$z =$$ \{ans_rule(10)\} $PAR 71 critical $$z$$ score $$\$$ \{ans_rule(10)\}$BR
72 \{ $mc1->print_q() \} 73$BR
74 \{ $mc1->print_a() \}$BR
75 (2) $$\$$ Test $$H_0: p = p[1]$$ against $$H_a: p < p[1]$$.  Use $$\alpha = a[1]$$. $PAR 76 test statistic $$z =$$ \{ans_rule(10)\}$PAR
77 critical $$z$$ score $$\$$ \{ans_rule(10)\} $BR 78 \{$mc2->print_q() \}
79 $BR 80 \{$mc2->print_a() \}$BR 81 (3) $$\$$ Test $$H_0: p = p[2]$$ against $$H_a: p \ne p[2]$$. Use $$\alpha = a[2]$$.$PAR
82 test statistic $$z =$$ \{ans_rule(10)\} $PAR 83 positive critical $$z$$ score $$\$$ \{ans_rule(10)\}$PAR
84 negative critical $$z$$ score $$\$$ \{ans_rule(10)\} $BR 85 \{$mc3->print_q() \}
86 $BR 87 \{$mc3->print_a() \}
88
89 END_TEXT
90 ANS(num_cmp($z[0])); 91 ANS(num_cmp($t[0], tol=>.01));
92 ANS(radio_cmp($mc1->correct_ans)); 93 ANS(num_cmp($z[1]));
94 ANS(num_cmp(-$t[1], tol=>.01)); 95 ANS(radio_cmp($mc2->correct_ans));
96 ANS(num_cmp($z[2])); 97 ANS(num_cmp($t[2], tol=>.01));
98 ANS(num_cmp(-$t[2], tol=>.01)); 99 ANS(radio_cmp($mc3->correct_ans));
100
101 ENDDOCUMENT();       # This should be the last executable line in the problem.