[R] Question about linear models

Ricardo Ríos ricardo.rios.sv at gmail.com
Wed Nov 19 05:44:07 CET 2008


Hi wizards,

I have the following model:

x<-c(20.79, 22.40, 23.15, 23.89, 24.02, 25.14, 28.49, 29.04, 29.88, 30.06)
y <- c(194.5, 197.9, 199.4, 200.9, 201.4, 203.6, 209.5, 210.7, 211.9, 212.2)
model1 <- lm( y ~ x )
anova(model1)

         Df Sum Sq Mean Sq F value    Pr(>F)
x          1 368.87  368.87  4384.6 3.011e-12 ***
Residuals  8   0.67    0.08


But, I have realized the following transformation:

lnx <- log(x)
lny <- log(y)
model2 <- lm( lny ~ lnx )
anova(model2)

Response: lny
         Df    Sum Sq   Mean Sq F value    Pr(>F)
lnx        1 0.0088620 0.0088620   27234 2.034e-15 ***
Residuals  8 0.0000026 0.0000003



The second model has a Sum of square Residuals very small

I have analyzed the following graph:

plot( model1$fitted.values, model1$residuals)
plot( model2$fitted.values, model2$residuals)


I have observed that maybe the first model has a specification error.
is that correct? Which model is the best?

 I was trying to get information about it, but I did not found anything.


Thanks in advance

-- 
http://ricardorios.wordpress.com/



More information about the R-help mailing list