How can I compare three linear models (fitlme)?
Show older comments
I have three different models with different random effects and funtions:
modelspec = 'Latency ~ 1 + TestNumber + (1|AnimalID)';
lmeinter = fitlme(data, modelspec);
modelspec = 'Latency ~ 1 + TestNumber + (1 + TestNumber|AnimalID)';
lmelin = fitlme(data,modelspec);
formula = 'Latency ~ 1+ TestNumber + TestNumber^2+ (1 + TestNumber|AnimalID)';
lmequad = fitlme(data, formula);
Now I would like to compare the performance of the different models. They are all nested. Using the "compare" function (Likelihiid ration test), I can compare two, but not three models. Is there a way to run an anova on models?
2 Comments
Harald
on 10 Nov 2023
Hi,
how about comparing two models, and then comparing the better model of the two to the third one?
Best wishes,
Harald
Star Strider
on 10 Nov 2023
One option could be to get the residuals from each regression (as column vectors) and then use the friedman function to see if any are different. Another option might be the multcompare function (there are also other versions of the function, so consider them to see which is most appropriate for what you want to do).
Accepted Answer
More Answers (0)
Categories
Find more on ANOVA in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!