Lucy McMahon
2017-Aug-15 14:06 UTC
[R] ANOVA test to decide whether to use multiple linear regression or linear mixed effects model
R-help: I am trying to decide between using a multiple linear regression or a linear mixed effects model for my data: model1 <- lm (responsevariable ~ predictor1 + predictor2 + predictor3 + predictor4, data= data) model2 <- lme (responsevariable ~ predictor1 + predictor2 + predictor3 + predictor4, random = ~1 | site, data= data) anova (model1, model2) but I keep getting the following error code: Error in anova.lmlist (object, ...): models were not all fitted to the same size of dataset Any advice would be appreciated, thanks. [[alternative HTML version deleted]]
S Ellison
2017-Aug-15 14:42 UTC
[R] ANOVA test to decide whether to use multiple linear regression or linear mixed effects model
> I am trying to decide between using a multiple linear regression or a linear > mixed effects model for my data: > ... > but I keep getting the following error code: > > Error in anova.lmlist (object, ...): > > models were not all fitted to the same size of datasetanova is defaulting to anova.lm, and that doesn't expect a mixed effects model. Switch them round to put model2 first: anova (model2, model1) S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}