[R] named lmer.models in do.call(anova,models)

Toth, Denes toth.denes at ttk.mta.hu
Wed Aug 28 13:04:53 CEST 2013


Hi,

For some reason do.call on anova fails if the models are named lmer objects.
Consider the following example:

library(lme4)
models <- list(
    lmer(Reaction ~ Days + (1| Subject), sleepstudy),
    lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
#
# models is an unnamed list, do.call works (although with warning):
do.call(anova, models)
#
# after labeling the models, do.call gives an error:
names(models) <- c("randomIC", "randomSlope")
do.call(anova, models)
#
# without do.call, anova works fine:
anova(models[[1]], models[[2]])


Is there a possibility to use do.call(anova, models) on named lmer-models?


Regards,
  Denes



More information about the R-help mailing list