Fixed effects only model with lme4
*If* you could trust that the log-likelihoods were generated using the same additive constants in both cases (which I don't think you can), and *if* you could trust the straight LRT for comparisons of random effects (see Pinheiro and Bates 2000, Scheipl, etc., for why it is really closer to a chi-squared mixture between 0 and 1 df) then you could use logLik() to extract the loglikelihoods of both models and pchisq(...,df=1,lower.tail=TRUE) to get a p-value (or divide that p-value by 2 to use a 0/1-df chi-squared mixture). Ben Bolker
Jeroen Ooms wrote:
2009/6/6 Douglas Bates <bates at stat.wisc.edu>
Try listing them the other way around anova(fm1, fm0) If the first model in the call to anova is of class "lm" then the method for that class is the one chosen and that method doesn't know about models created by lmer. You must list them so that the lmer model comes first.
this still returns an error:
fm0 <- lm(Reaction ~ Days, sleepstudy); fm1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy); anova(fm0,fm1);
Error in x$terms : $ operator not defined for this S4 class
anova(fm1,fm0);
Error in FUN(X[[1L]], ...) : no slot of name "call" for this object of class "lm" similar error if I use glm instead of lm. [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Ben Bolker Associate professor, Biology Dep't, Univ. of Florida bolker at ufl.edu / www.zoology.ufl.edu/bolker GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc