Re: [R] Anova over a list of models

2009-09-06 Thread Schalk Heunis
Jeroen This seems to work for (1): anova(myModels[[1]], force(myModels[[2]])) OR anova(myModels[[1]], (myModels[[2]])) I suspect this is about lazy-evaluation, looking at the source code for anova for mer objects: selectMethod("anova","mer"), something goes wrong with the sapply to get the names,

Re: [R] Anova over a list of models

2009-09-05 Thread Jeroen Ooms
2009/9/5 Henrique Dallazuanna > > Try this: > anova(myModels[[1]],myModels[[2]]) > > do.call(anova, myModels) Does this work for you? Both functions are failing here: > anova(myModels[[1]],myModels[[2]]) Error in names(mods) <- sapply(as.list(mCall)[c(FALSE, TRUE, modp)], as.character) :   'name

Re: [R] Anova over a list of models

2009-09-05 Thread Henrique Dallazuanna
Try this: 1) anova(myModels[[1]],myModels[[2]]) 2) do.call(anova, myModels) On Sat, Sep 5, 2009 at 5:18 PM, Jeroen Ooms wrote: > > I have a list object, in which I have stored n lme4-models. For example: > > library(lme4); > myModels <- list(); > myModels[1] <- lmer(Reaction ~ Days + (Days|Sub

[R] Anova over a list of models

2009-09-05 Thread Jeroen Ooms
I have a list object, in which I have stored n lme4-models. For example: library(lme4); myModels <- list(); myModels[1] <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) myModels[2] <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy) Now I would like to perform an anova ove