Lecture 10

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

Categorical Data Analysis

Lecturer 10
Hypothesis tests for regression parameters

We often want to assess the importance of an


explanatory variable or groups of explanatory variables.
One way to make this assessment is through using
hypothesis tests. For example, suppose we are
interested in the rth explanatory variable xr in the model

logit( )  0  1x1    r xr    p xp
If r = 0, we see that xr would be excluded from the
model. Thus, we are interested in hypothesis tests of the
form:

H0: r = 0
Ha: r  0

Alternatively, we could state the hypotheses as:

H0 :logit( )  0  1x1    r 1xr 1  r 1xr 1    p xp


Ha :logit( )  0  1x1    r xr    p xp
Notice that the null hypothesis model terms are all included
within the alternative hypothesis model. In other words, the
null hypothesis model is a special case of the alternative
hypothesis model. For this reason, the null hypothesis model
is often referred to as a reduced model and the alternative
hypothesis model is often referred to as a full model.
Wald test
The Wald statistic is

r

Z0 

Var(ˆr )

to test H0: r = 0 vs. Ha: r  0. For a large sample,


the test statistic has an approximate standard
normal distribution if the null hypothesis of r = 0 is
true. Thus, reject the null hypothesis if we observe a
test statistic value that is “unusual” for a standard
normal distribution. We define unusual to be
Z0  Z1 / 2 . The p-value is 2P(Z  Z0 ) where Z ~
N(0,1).
Likelihood ratio test (LRT)
Generally, a better test than the Wald is a LRT. The LRT
statistic is again:

Maximum of likelihood function under H0



Maximum of likelihood function under H0 o r Ha

To perform a test of H0: r = 0 vs. Ha: r  0, we obtain


the estimated probabilities of success from estimating

logit( )  0  1x1    r 1xr 1  r 1xr 1    p xp


(suppose the estimates are ̂ , ̂ , … ̂ ) and the
(0)
i
(0)
0
(0)
p
estimated probabilities of success from estimating

logit( )  0  1x1    r xr    p xp

(suppose the estimates are ̂ , ̂ , … ̂ ). We can


(a)
i
(a)
0
(a)
p
then find

 L(ˆ (0) | y1,,yn ) 


2log(  )  2log  
 L(ˆ (a)
| y1,,yn ) 
where I use ̂ and ̂ to be vectors of parameters
(0) (a)

under the H0 and Ha models. If the null hypothesis was


true, -2log() has an approximate 1 distribution for a
2

large sample.

The hypotheses can be generalized to allow for q


different ’s in H0 to be set to 0. When this happens and
the null hypothesis is true, -2log() has an approximate
q distribution for a large sample.
2
Example: Placekicking
Consider the model with both change and distance
included in it:

logit( )  0  1change  2 distance

To perform Wald tests on each of these variables, we


can examine the summary(mod.fit2) output from
earlier:
Change Distance
H0: 1 = 0 H0: 2 = 0
Ha: 1  0 Ha: 2  0
Z0 = -2.31 Z0 = -13.37
p-value = 0.0208 p-value < 210-16
Reject H0 because p-value Reject H0 because p-value
is small is small
There is sufficient There is sufficient
evidence to indicate evidence to indicate
change has an effect on distance has an effect on
the probability of success the probability of success
given distance is in the given change is in the
model. model.
There is marginal evidence to indicate that change
has an effect on the probability of success given
distance is in the model.

There are a number of ways to perform LRTs in R. The


easiest way to perform the tests of interest here is to use the
Anova() function from the car package. This package is not
automatically installed in R so you will need to install it prior
to its use.
> library(package = car)
> Anova(mod = mod.fit2, test = "LR")
Analysis of Deviance Table (Type II tests)

Response: good
LR Chisq Df Pr(>Chisq)
change 5.246 1 0.02200 *
distance 218.650 1 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 '
' 1

Notice the p-values are quite similar to the p-values for


the Wald test. This is due to the large sample.

You might also like