[R-lang] [SPAM] Re: Poisson MLR

Austin Frank austin.frank at gmail.com
Fri Apr 10 10:04:58 PDT 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 193 bytes
Desc: not available
URL: <http://pidgin.ucsd.edu/pipermail/r-lang/attachments/20090410/7265702a/attachment.pgp>


More information about the R-lang mailing list