Chris Bergstresser
2006-May-18 07:20 UTC
[R] Running a likelihood ratio test for a logit model
Hi all -- I have to calculate a likelihood ratio test for a logit model. I found logLik, but I need to calculate the log likelihood for the model without any predictors. How can I specify this in glm? If the full model is glm(y ~ x1), is the one without predictors (y ~ 0)? Or (y ~ 1)? Is there a more direct way of getting this? -- Chris
Dimitris Rizopoulos
2006-May-18 07:44 UTC
[R] Running a likelihood ratio test for a logit model
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.
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Chris Bergstresser" <chris at subtlety.com>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, May 18, 2006 9:20 AM
Subject: [R] Running a likelihood ratio test for a logit model
> Hi all --
>
> I have to calculate a likelihood ratio test for a logit model. I
> found logLik, but I need to calculate the log likelihood for the
> model
> without any predictors. How can I specify this in glm? If the full
> model is glm(y ~ x1), is the one without predictors (y ~ 0)? Or (y
> ~
> 1)?
> Is there a more direct way of getting this?
>
> -- 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
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
Prof Brian Ripley
2006-May-18 08:56 UTC
[R] Running a likelihood ratio test for a logit model
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). 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 For the record, the null model always includes any offsets, and it includes and intercept iff the full model does.> ----- Original Message ----- > From: "Chris Bergstresser" <chris at subtlety.com> > To: <r-help at stat.math.ethz.ch> > Sent: Thursday, May 18, 2006 9:20 AM > Subject: [R] Running a likelihood ratio test for a logit model > > >> Hi all -- >> >> I have to calculate a likelihood ratio test for a logit model. I >> found logLik, but I need to calculate the log likelihood for the >> model >> without any predictors. How can I specify this in glm? If the full >> model is glm(y ~ x1), is the one without predictors (y ~ 0)? Or (y >> ~ >> 1)? >> Is there a more direct way of getting this?-- 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
Reasonably Related Threads
- Likelihood ratio test between glm and glmer fits
- likelihood ratio test between glmer and glm
- Why there is no p-value from likelihood ratio test using anova in GAM model fitting?
- mixed model random interaction term log likelihood ratio test
- logit model interpretation