[npl] / trunk / NationalProblemLibrary / UVA-Stat / setStat212-Homework12 / stat212-HW12-16.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Annotation of /trunk/NationalProblemLibrary/UVA-Stat/setStat212-Homework12/stat212-HW12-16.pg

 1 : jjholt 451 ## DESCRIPTION 2 : ## Statistics: Sampling Distributions 3 : ## ENDDESCRIPTION 4 : ##DESCRIPTION 5 : ##KEYWORDS('statistics','hypothesis testing') 6 : ## 7 : ## naw tagged this problem 8 : 9 : ## DBchapter('Hypothesis Testing') 10 : ## DBsection('Common Large-Sample Tests') 11 : ## Date('7/8/2005') 12 : ## Author('Nolan A. Wages') 13 : ## Institution('University of Virgnia') 14 : jjholt 453 ## TitleText1('Mathematical Statistics') 15 : jjholt 451 ## EditionText1('4') 16 : ## AuthorText1('Wackerly, Mendenhall, Scheaffer') 17 : ## Section1('10.3') 18 : ## Problem1('20') 19 : 20 : 21 : ##ENDDESCRIPTION 22 : 23 : DOCUMENT(); # This should be the first executable line in the problem. 24 : 25 : loadMacros( 26 : "PG.pl", 27 : "PGbasicmacros.pl", 28 : "PGchoicemacros.pl", 29 : "PGanswermacros.pl", 30 : "PGgraphmacros.pl", 31 : "PGnumericalmacros.pl", 32 : "PGstatisticsmacros.pl", 33 : "PGauxiliaryFunctions.pl", 34 : "extraAnswerEvaluators.pl" 35 : ); 36 : 37 : 38 : 39 : TEXT(beginproblem()); 40 : $showPartialCorrectAnswers = 0; 41 : install_problem_grader(~~&std_problem_grader); 42 : 43 :$x[1] = random(-3,-1,1); 44 : $x[2] = random(0,3,1); 45 :$x[3] = random(4,6,1); 46 : $x[4] = random(7,9,1); 47 :$x[5] = random(9,12,1); 48 : 49 : $y[1] = 3 + random(-3,-1,1); 50 :$y[2] = 6 + random(0,3,1); 51 : $y[3] = 9 + random(4,6,1); 52 :$y[4] = 12 + random(6,8,1); 53 : $y[5] = 15 + random(8,12,1); 54 : 55 :$n = 5; 56 : 57 : $xbar = ($x[1]+$x[2]+$x[3]+$x[4]+$x[5])/$n; 58 :$ybar = ($y[1]+$y[2]+$y[3]+$y[4]+$y[5])/$n; 59 : 60 : $sx = sqrt( (($x[1]-$xbar)**2 + ($x[2]-$xbar)**2 + ($x[3]-$xbar)**2 + ($x[4]-$xbar)**2 + ($x[5]-$xbar)**2)/($n-1) ); 61 : $sy = sqrt( (($y[1]-$ybar)**2 + ($y[2]-$ybar)**2 + ($y[3]-$ybar)**2 + ($y[4]-$ybar)**2 + ($y[5]-$ybar)**2)/($n-1) ); 62 : 63 : $cov = ( ($x[1]-$xbar)*($y[1]-$ybar) + ($x[2]-$xbar)*($y[2]-$ybar) + ($x[3]-$xbar)*($y[3]-$ybar) 64 : + ($x[4]-$xbar)*($y[4]-$ybar) + ($x[5]-$xbar)*($y[5]-$ybar) )/($n-1); 65 : 66 : $b1 =$cov/$sx**2; 67 :$b0 = $ybar -$b1*$xbar; 68 : 69 :$sse = ($n-1)*($sy**2 - ($cov/$sx)**2); 70 : $se = sqrt($sse/($n-2)); 71 :$r2 = ($cov/($sx*$sy))**2; 72 : 73 :$x1 = random(1,5,1); 74 : $x2 = random(6,10,1); 75 : 76 :$yhat1 = $b0 +$b1*$x1; 77 :$yhat2 = $b0 +$b1*$x2; 78 : 79 : 80 : BEGIN_TEXT 81 : 82 : Find the least-squares regression line 83 : $$\hat{y} = b_0 + b_1 x$$ through the points 84 : 85 : $86 : (x[1],y[1]), (x[2],y[2]), (x[3],y[3]), (x[4],y[4]), (x[5],y[5]), 87 :$ 88 : and then use it to find point estimates $$\hat{y}$$ corresponding to 89 : $$x = x1$$ and $$x = x2$$. 90 :$PAR 91 : 92 : For $$x = x1$$, $$\hat{y}$$ = \{ ans_rule(15) \} 93 : 94 : $PAR 95 : 96 : For $$x = x2$$, $$\hat{y}$$ = \{ ans_rule(15) \} 97 : 98 :$PAR 99 : 100 : END_TEXT 101 : 102 : ANS(num_cmp($yhat1)); 103 : ANS(num_cmp($yhat2)); 104 : 105 : ENDDOCUMENT(); # This should be the last executable line in the problem.