0

I have a list of linear regressions generated using lmList (from lme4), similar to what was done here:

Now I want to compare these models using an ANOVA.

I've tried this:

anova(models_list)

but I get this:

Error in UseMethod("anova") : 
no applicable method for 'anova' applied to an object of class" c('lmList4', 'list', 'vector')"

So then I tried this:

anova.lmlist(models_list)

but I get an error saying it can't find this function, even though it appears to be part of the base stats package.

holastello
  • 593
  • 1
  • 7
  • 16
  • It's defined in `stats` but it's not exported. You can try `stats:::anova.lmlist(models_list)`, but beware, unexported functions are generally not meant to be called directly. – MrFlick Feb 15 '18 at 21:52
  • 1
    In fact, `lapply(models_list, anova)` would probably be safer. – MrFlick Feb 15 '18 at 21:54
  • @MrFlick I didn't know about unexported functions, thanks. My understanding of the *apply functions is still shaky but I'm not sure using `lapply` like that accomplishes what I'm after... comparing all the models to eachother (or really comparing all models to the first model) – holastello Feb 15 '18 at 23:16

0 Answers0