'Comparing models using Anova [duplicate]

Im trying to compare 6 models using the Anova function. mod1:4 are made using the lm function and mod 5 and 6 are models made using the lmer function. I think this is whats causing this error message, any ideas how i can compare these 6 models?

anova(mod1, mod2, mod3, mod4, mod5, mod6)
Error: $ operator not defined for this S4 class


Solution 1:[1]

I would recommend comparing models using compare_performance() from performance package instead of anova().

This way you can compare AIC, BIC, R-squared, and so on.

See the material here: https://easystats.github.io/performance/articles/compare.html

After visual comparison, I would recommend you using test_performance() from the same package.

I would also recommend you to rerun your models using the functions they recommend.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ruam Pimentel