MATH 376 -- Probability and Statistics 2
A hypothesis test on a regression coefficient
April 15, 2010
> | with(Statistics): with(plots): |
Using the median housing price data from class a few days ago.
We enter the lists of x and y coordinates of the data points separately.
> | XList:=[0.,1,2,3,4,5,6,7]; |
(1) |
> | YList:=[27.6,32.5,35.9,39.3,44.8,48.8,55.7,62.9]; |
(2) |
Means:
> | Xbar:=Mean(XList); |
(3) |
> | Ybar:=Mean(YList); |
(4) |
Organizing the computation of the least squares estimators of the regression coefficients
as we described in class:
> | SXY:=add((XList[i]-Xbar)*(YList[i]-Ybar),i=1..8); |
(5) |
> | SXX:=add((XList[i]-Xbar)*(XList[i]-Xbar),i=1..8); |
(6) |
> | hatbeta[1]:=SXY/SXX; |
(7) |
> | hatbeta[0]:=Ybar-hatbeta[1]*Xbar; |
(8) |
We can ask whether there is evidence to say that the median house price was
increasing at a rate less than 5 thousand dollars per year.
That is, we set up for testing
: (or perhaps ≥ 5 -- essentially equivalent) 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); |
(9) |
> | S2:=(1/(8-2))*(SYY-hatbeta[1]*SXY); |
(10) |
Then the test statistic is , where
> | t:=(hatbeta[1] - 5)/sqrt(S2/SXX); |
(11) |
The test statistic has a t-distribution with 8 - 2 = 6 d.f. so the
p-value for the lower tail test is:
> |
(12) |
> | CDF(T,t); |
(13) |
Note: 1 - CDF(T,-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