1
$\begingroup$

I am running mixed-effects analysis using lme package in R. I am trying to understand whether a linear model or a polynomial curve would better capture the change in a variable over time.

I know that anova() can be used to make model comparisons. Can I also use anova() to compare a linear and a quadratic model?

Thank you.

$\endgroup$
  • $\begingroup$ You can do that, but with 'lme' you have to be carefull; you should use method='ML' so you may not use REML because with REML the likelihoods are ''modified''. $\endgroup$ – user83346 Jul 15 '16 at 9:24
0
$\begingroup$

Yeah you can. anova() can be used for model comparison whenever two nested models are fitted to the same set of data. In this case you wish to compare a linear model

$y = \beta_0 + \beta_1 x$

with a quadratic model

$y = \beta_0 + \beta_1 x + \beta_2 x^2$

As long as nothing is different between the two model apart from the presence of the quadratic term ($\beta_2 x^2$) then this is a perfectly reasonable comparison to make.

(Strictly speaking, it should still be a reasonable comparison to make if there were other variables added in the quadratic model too, but it would no longer be a test of whether a model with a quadratic term is a better fit to the data than one with only a linear term.)

Edit: As fcop has pointed out. It's only appropriate to use anova() for comparisons between mixed effects models (such as those produced by lme() and g/lmer()) when they have been fit using maximum likelihood, rather than with REML.

$\endgroup$
  • 1
    $\begingroup$ I think you have to be more specific; with lme you can do it, but you should use method='ML' because method='REML' uses a modified likelihood. $\endgroup$ – user83346 Jul 15 '16 at 9:25
  • $\begingroup$ And one more question: I am planning to use orthogonal polynomials with poly() command. I can still do the comparison I guess, right? $\endgroup$ – Berna Jul 15 '16 at 9:30
  • $\begingroup$ @Berna: fine, you should use 'ML' to compare the models, but once you decided on a model for the mean you should use REML because that method is better for estimating the variance. $\endgroup$ – user83346 Jul 15 '16 at 9:31
  • $\begingroup$ @Berna yeah, using poly is fine. You'd compare one model containing, e.g., poly(x, 1) with another containing poly(x, 2). $\endgroup$ – Ian_Fin Jul 15 '16 at 9:33
  • $\begingroup$ @Berna No need to say thanks. If you feel the answer has satisfactorily addressed your question then I'd encourage you to consider accepting it as an answer. $\endgroup$ – Ian_Fin Jul 15 '16 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.