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

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


Sorry, I missed to attach the sessionInfo, here it goes:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=C     
           LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_1.1-0      Matrix_1.0-12   lattice_0.20-15

loaded via a namespace (and not attached):
[1] grid_3.0.1    MASS_7.3-26   minqa_1.2.1   nlme_3.1-109  splines_3.0.1
tools_3.0.1


> 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