Skip to content
Prev 12509 / 20628 Next

anova (lm, lmer ) question

On 14-10-06 12:36 PM, Farrar, David wrote:
I didn't mean to imply that anova(m.ML,m.lm) would actually work, but
rather that the equivalent calculation would be appropriate, e.g.

    library(lme4)
    fm1 <- lmer(Reaction ~ Days + (1 | Subject), sleepstudy, REML=FALSE)
    fm0 <- lm(Reaction ~ Days, sleepstudy)
    NL1 <- -logLik(fm1)
    NL0 <- -logLik(fm0)
    devdiff <- 2*(NL0-NL1)
    dfdiff <- attr(NL1,"df")-attr(NL0,"df")
    pchisq(devdiff,dfdiff,lower.tail=FALSE)

The p-value is very small in this case, but that's consistent
with a large/well-determined variance estimate ...

    pp <- profile(fm1)
    library(lattice)
    xyplot(logProf(pp))

Keep in mind that the likelihood ratio test also has some theoretical
problems in this case, mainly with boundary issues (see
http://glmm.wikidot.com/faq for more info)