Skip to content
Prev 320450 / 398506 Next

lmer, p-values and all that

On 13-03-27 10:10 PM, David Winsemius wrote:
OK, I misspoke -- sorry.  I think the lmer()/lme() likelihoods are
actually comparable; it's GLMMs (glmer(), with no analogue in lme()-land
except
for MASS::glmmPQL, which doesn't give you log-likelihoods at all)
where the problem arises.

  You can (1) use lme(), (2)  look at http://glmm.wikidot.com/faq for
suggestions about testing random-effects terms (including "perhaps
don't do it at all"), or (3) construct the likelihood ratio test
yourself as follows:

library("nlme")
data(Orthodont)
fm1 <- lme(distance~age,random=~1|Subject,data=Orthodont)
fm0 <- lm(distance~age,data=Orthodont)
anova(fm1,fm0)[["p-value"]]
detach("package:nlme",unload=TRUE)
library("lme4.0") ## stable version of lme4
fm2 <- lmer(distance~age+(1|Subject),data=Orthodont,REML=FALSE)
anova(fm2,fm0) ## fails
ddiff <- -2*c(logLik(fm0)-logLik(fm2))
pchisq(ddiff,1,lower.tail=FALSE)
## not identical to above but close enough