[R] ANOVA between linear models.

From: Richard Martin <radiosity_at_gmail.com>
Date: Thu, 15 May 2008 15:27:03 +0100

Hi All,

I'm accustomed to performing an ANOVA to aid in choosing between linear models (for example y~x or y~x+x^2), however with different models I can't seem to do it. I'm trying to fit an exponential model of the form ye^(bt).

Below is a code snippet that highlights what I'm trying to do

s = rnorm(100, sd = 1, mean=10)
s = s + seq(0.1,10,0.1)
x = 1:length(s)
model.lin = lm(s ~ x)

model.poly = lm(s ~x + I(x^2))
model.exp = lm(log(s) ~ x)

anova(model.lin, model.poly)
#gives the correct outcome

anova(model.lin, model.exp)

This fails because of the transformation of the response variable. Can anyone give any advice as to how I should proceed - is there a different test to use in this instance, or some way of reversing the transform after the model has been fitted?

Any help greatly appreciated!!


Contendere, Explorare, Invenire, et non Cedere

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 15 May 2008 - 19:24:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 16 May 2008 - 14:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive