[R] Anova over a list of models

Jeroen Ooms j.c.l.ooms at uu.nl
Sat Sep 5 22:18:25 CEST 2009


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 over all models in the list. However,
the anova function requires that every model is inserted as a seperate
argument, i.e. anova(model1,model2). I run into two problems:
1) anova(myModels[1],myModels[2]) returns an error.
2) if n, the number of models, is unknown, how do I add all models as a
seperate argument? 



-----
Jeroen Ooms * Dept. of Methodology and Statistics * Utrecht University 

Visit  http://www.jeroenooms.com www.jeroenooms.com  to explore some of my
current projects.





 
-- 
View this message in context: http://www.nabble.com/Anova-over-a-list-of-models-tp25311985p25311985.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list