MATH 376 -- Probability and Statistics 2
April 7, 2006
First Least Squares Regression Example, continued
The housing price data:
> | read "/home/fac/little/public_html/ProbStat0506/MSP.map"; |
Warning, the name changecoords has been redefined
Repeating computation of the estimators for the coefficients in the model
Y =
We enter the lists of x and y coordinates of the data points separately:
> | XList:=[0.,1,2,3,4,5,6,7]; |
> | YList:=[27.6,32.5,35.9,39.3,44.8,48.8,55.7,62.9]; |
Means:
> | Xbar:=Mean(XList); |
> | Ybar:=Mean(YList); |
Organizing the computation as we described in class:
> | SXY:=add((XList[i]-Xbar)*(YList[i]-Ybar),i=1..8); |
> | SXX:=add((XList[i]-Xbar)*(XList[i]-Xbar),i=1..8); |
> | hatbeta[1]:=SXY/SXX; |
> | hatbeta[0]:=Ybar-hatbeta[1]*Xbar; |
Now, we set up for testing
:
versus the alternative
:
To compute the test statistic we need the estimator
for the variance
> | SYY:=add((YList[i]-Ybar)*(YList[i]-YBar),i=1..8); |
> | S2:=(1/(8-2))*(SYY-hatbeta[1]*SXY); |
Then the test statistic is
, where
> | t:=(hatbeta[1] - 5)/sqrt(S2/SXX); |
The test statistic has a t -distribution with 8 - 2 = 6 d.f. so the
p- value is:
> | TCDF(6,t); |
Note: 1 - TCDF(6,-t) gives the same result by symmetry of the t
density function.
This value is much too large to indicate rejection of
. There is
not sufficient evidence to suggest that