[R] ANOVA between linear models.

Richard Martin radiosity at gmail.com
Thu May 15 16:27:03 CEST 2008


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)
#doesn't.

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!!

Richard

-- 
Contendere, Explorare, Invenire, et non Cedere



More information about the R-help mailing list