> Thanks for this answer but does that mean that working with the deviances is better? Or how else could I evaluate the importance of my random terms?
Many thanks, Davnah > On Mar 14, 2010, at 8:12 PM, hadley wickham wrote: > >>> Based on a discussion found on the R mailing list but dating back to 2008, >>> I have compared the log-likelihoods of the glm model and of the glmer model >>> as follows: >>> >>> lrt <- function (obj1, obj2){ >>> L0 <- logLik(obj1) >>> L1 <- logLik(obj2) >>> L01 <- as.vector(- 2 * (L0 - L1)) >>> df <- attr(L1, "df") - attr(L0, "df") >>> list(L01 = L01, df = df, "p-value" = pchisq(L01, df, lower.tail = FALSE)) } >>> >>> gm0 <- glm(cbind(female,male)~date,family = binomial, data = liz3) >>> gm1 <- glmer(cbind(female,male)~date+(1|dam),family=binomial,data= liz3) >>> >>> lrt(gm0, gm1) >> >> It is _very_ dangerous to do this as the likelihoods are unlikely to >> be comparable/compatible. >> >> Hadley >> >> >> -- >> Assistant Professor / Dobelman Family Junior Chair >> Department of Statistics / Rice University >> http://had.co.nz/ > > Davnah Urbach > Post-doctoral researcher > Dartmouth College > Department of Biological Sciences > 401 Gilman Hall > Hanover, NH 03755 (USA) > lab/office: (603) 646-9916 > davnah.urb...@dartmouth.edu > Davnah Urbach Post-doctoral researcher Dartmouth College Department of Biological Sciences 401 Gilman Hall Hanover, NH 03755 (USA) lab/office: (603) 646-9916 davnah.urb...@dartmouth.edu Davnah Urbach Post-doctoral researcher Dartmouth College Department of Biological Sciences 401 Gilman Hall Hanover, NH 03755 (USA) lab/office: (603) 646-9916 davnah.urb...@dartmouth.edu ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.