Home page for accesible maths 8.4 Hypothesis tests for the regression coefficients

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

Linear combinations of the regression coefficients

A similar approach can be taken for linear combinations of regression coefficients. From Section 8.2, we know that aβ^ also has a normal distribution, with mean aβ and variance σ2a(XX)-1a. To test

H0:aβ=b

vs.

H1:aβb,

we use a similar argument as above, comparing the test statistic

t=aβ^-bVar(aβ^)

to the tn-p distribution.

The variance of aβ^ can be calculated using the expression σ2a(XX)-1a.

TheoremExample 8.4.1 Birth weights cont.

Recall the simple linear regression relating birth weight to gestational age at birth,

𝔼[Yi]=β1+β2xi.

We want to test whether gestational age has a significant positive effect on birth weight, that is, H0:β2=0 vs. H1:β2>0.

First, calculate (XX)-1. From Example 7.1.1 this is,

(XX)-1=[19.6-0.507-0.5070.0132].

Now calculate the test statistic,

t=β^2-bσ^2(XX)2,2-1=116-037455×0.0132=11622.2=5.22.

Compare t=5.22 to the t22 distribution. From R, t22(0.95) is 1.72. Since 5.22>1.72, we conclude that there is evidence to reject H0 at the 5% level and say that gestational age at birth does affect birth weight.

We can use R to help us with the test. Consider again the output of the summary function

> summary(bwtlm)
summary(bwtlm)
Call:
lm(formula = bwt$Weight ~ bwt$Age)
Residuals:
Min      1Q  Median      3Q     Max
-262.03 -158.29    8.35   88.15  366.50
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)  -1485.0      852.6  -1.742   0.0955 .
bwt$Age        115.5       22.1   5.228 3.04e-05 ***
---
Signif. codes:  0 â€˜***’ 0.001 â€˜**’ 0.01 â€˜*’ 0.05 â€˜.’ 0.1 â€˜ â€™ 1
Residual standard error: 192.6 on 22 degrees of freedom
Multiple R-squared: 0.554,      Adjusted R-squared: 0.5338
F-statistic: 27.33 on 1 and 22 DF,  p-value: 3.04e-05

Note that we can obtain the standard error of β^2 directly from the Coefficients table. In fact, we can obtain the p-value for the required test, p=0.0000304/2=0.0000152<0.05. This is clearly significant at the 5% level. However, if we want to test βj=b where b0, we must still calculate the test statistic by hand. For examination purposes, you will be expected to be able to calculate the test statistic using expression (8.3), so do not become too reliant on R.

TheoremExample 8.4.2 Gas consumption cont.

Recall from equation (6.6) the model relating gas consumption to outside temperature and whether or not cavity wall insulation has been installed. We fitted this model in Example 7.1.3.

  1. 1

    Before cavity wall insulation was installed, was there a significant relationship between outside temperature and gas consumption?

  2. 2

    After cavity wall insulation was installed, is there a significant relationship between outside temperature and gas consumption?

To answer question 1, we test

H0:β2=0

vs.

H1:β20.

To do this, first calculate the estimated residual variance σ^2=0.0728 by calculating the fitted values, then the residuals and finally using expression (7.5).

Since we are testing β2, we need (XX)2,2-1. In R,

> X <- matrix(cbind(rep(1,44),gas$Temp,gas$Insulate2,
gas$Insulate2*gas$Temp),ncol=4)
> solve(t(X)%*%X)[2,2]
[1] 0.004846722

Then the test statistic is

t=β^2-0σ^2(XX)2,2-1=-0.3930.0728×0.00485=-20.9

Since n=44 and p=4, we compare to t40(0.025)=-2.021. Clearly |-20.9|=20.9>2.021, so we conclude that there is evidence to reject the null hypothesis at the 5% level. i.e. there is evidence of a relationship between outside temperature and gas consumption.

We have seen that the relationship between gas consumption and outside temperature after insulation is given by β2+β4. So, to answer question 2, we need to test

H0:β2+β4=0

vs.

H1:β2+β40.

First, calculate the variance of β^2+β^4. From Math230,

Var(β^2+β^4) =Cov(β^2+β^4,β^2+β^4)
=Var(β^2)+2Cov(β^2,β^4)+Var(β^4)
=σ2(XX)2,2-1+2σ2(XX)2,4-1+σ2(XX)4,4-1
=σ2[(XX)2,2-1+2(XX)2,4-1+(XX)4,4-1].

Next, obtain the required elements from (XX)-1,

> X <- matrix(cbind(rep(1,44),gas$Temp,gas$Insulate2,
gas$Insulate2*gas$Temp),ncol=4)
> solve(t(X)%*%X)[2,2]
[1] 0.004846722
> solve(t(X)%*%X)[2,4]
[1] -0.004846722
> solve(t(X)%*%X)[4,4]
[1] 0.02723924

and calculate the test statistic,

t =β^2+β^4Var(β^2+β^4)
=-0.393+0.1440.0728×(0.00485+2×-0.00485+0.273)
=-0.2500.0728×0.0272
=-6.18.

Finally, compare t=|-6.18|=6.18 to t40(0.975)=2.021. Since 6.18>2.021 we conclude that, at the 5% level, there is evidence of a relationship between gas consumption and outside temperature, once insulation has been installed. So, the insulation has not entirely isolated the house from the effects of external temperature, but it does appear to have weakened this relationship.