[R] Running a likelihood ratio test for a logit model

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 18 16:58:21 CEST 2006


On Thu, 18 May 2006, Chris Bergstresser wrote:

> On 5/18/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>> On Thu, 18 May 2006, Dimitris Rizopoulos wrote:
>>
>>> the print method for glm object already shows you the null and
>>> residual deviance with the associated df; look also at the "Value"
>>> section of ?glm.
>>
>> Note though that deviances are not (log) likelihood ratios, but
>> differences in deviances are twice log LRT (pace a previous answer).
>
>   Ah, that's what I wanted.  I was confused because the book I'm
> working out of (Agresti's _An Introduction to Categorical Data
> Analysis_) never refers to the components of the log LRT as deviances.
>
>> anova() is a good way to get suitable tests out of model fits:
>> in this case
>>
>>      anova(glm(y ~ x1, family=binomial))
>>
>> shows you the appropriate 2 log LRT
>
>    I've been using that for comparing models, but got a little
> confused because it didn't spit out an associated p-value.  I tried

You need to tell it you want to do a test, for an appropriate test 
statistic ("Chisq" for a logistic regression).  (All in good books about 
doing statistical modelling with R/S.)

> summary(anova) but that's just ridiculous.
>   Does aov compute basically the same test, but using the F
> distribution rather than the chisq?
>
> -- Chris
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list