On Fri, Apr 10 2009, Peter Graff wrote:

> I was wondering if someone knew how to get a glm (family=poisson) to
> spit out the Model Likelihood ratio, or more generally how to
> calculate it from the deviance.

Likelihood ratios apply between to different models, single models have
a log likelihood.  Are you comparing two models?

To get the log likelihood for a single model, you can use logLik(model).

To do a likelihood ratio test between two models, you can use
anova(model1, model2).

Using the example from ?glm,

--8<---------------cut here---------------start------------->8---
     ## EXAMPLE

     ## Dobson (1990) Page 93: Randomized Controlled Trial :
     counts <- c(18,17,15,20,10,20,25,13,12)
     outcome <- gl(3,1,9)
     treatment <- gl(3,3)
     print(d.AD <- data.frame(treatment, outcome, counts))
     glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
     anova(glm.D93)
     summary(glm.D93)


     ## LOG LIKELIHOOD
     logLik(glm.D93)

     ## MODEL COMPARISON
     glm.D93.1 <- glm(counts ~ 1, family=poisson())
     anova(glm.D93, glm.D93.1)
--8<---------------cut here---------------end--------------->8---

HTH,
/au
     
-- 
Austin Frank
http://aufrank.net
GPG Public Key (D7398C2F): http://aufrank.net/personal.asc

Attachment: pgp3gmwCOkBuN.pgp
Description: PGP signature

_______________________________________________
R-lang mailing list
[email protected]
http://pidgin.ucsd.edu/mailman/listinfo/r-lang

Reply via email to