> 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/ ______________________________________________ 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.