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/
You can always inflate the SS by using smaller units, which is what your log transformation is doing. What is important for inference is the ratios of those sums of squares. The rest of your homework is something you will need to complete yourself. http://www.ugr.es/~falvarez/relaMetodos2.pdf ..... see Question 9 http://www.uclm.es/profesorado/jesuslopezfidalgo/MODELOS.pdf ...... see Question 47 -- David Winsemius, MD Heritage Labs On Nov 18, 2008, at 11:44 PM, Ricardo R?os wrote:> 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/ > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Er, ... the log transform is more like using larger units (giving smaller numerical values.) On Nov 18, 2008, at 11:55 PM, David Winsemius wrote:> You can always inflate the SS by using smaller units, which is what > your log transformation is doing. What is important for inference > is the ratios of those sums of squares. The rest of your homework is > something you will need to complete yourself. > > http://www.ugr.es/~falvarez/relaMetodos2.pdf ..... see Question 9 > http://www.uclm.es/profesorado/jesuslopezfidalgo/MODELOS.pdf ...... > see Question 47 > > -- > David Winsemius, MD > Heritage Labs > > > On Nov 18, 2008, at 11:44 PM, Ricardo R?os wrote: > >> 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/ >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.