[This email is either empty or too large to be displayed at this time]
Dear R-users: Sorry for the naiveness of my question but I have been trying in the R-help and the CRAN website without any success. I am trying to perform a regression through the origin (without intercept) and my main concern is about its evaluative statistics. It is clear for me that R squared does not make sense if you do not have an intercept in your model and how big is the assumption that the response is zero when all the predictors are zero. If I still want to perform a regression in that conditions, does R have any options to evaluate the model adequacy correctly? Thanks in advance, Leonardo Trujillo.
Hi, a first step to answer your question: Regression through the origin (without intercept) can be done by explicitly stating in the 'formula' argument '-1' If you check the help page of 'lm' for example: help(lm) It will say in the 'Details' section: A formula has an implied intercept term. To remove this use either 'y ~ x - 1' or 'y ~ 0 + x'. See 'formula' for more details of allowed formulae. An example is given at the end of the help page: ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2,10,20, labels=c("Ctl","Trt")) weight <- c(ctl, trt) anova(lm.D9 <- lm(weight ~ group)) summary(lm.D90 <- lm(weight ~ group - 1))# omitting intercept I hope this helps a bit. Best, Roland> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Trujillo L. > Sent: Tuesday, May 23, 2006 12:54 PM > To: r-help at stat.math.ethz.ch > Subject: [R] Regression through the origin > > Dear R-users: > > Sorry for the naiveness of my question but I have been trying in the > R-help and the CRAN website without any success. I am trying > to perform > a regression through the origin (without intercept) and my > main concern > is about its evaluative statistics. It is clear for me that R squared > does not make sense if you do not have an intercept in your model and > how big is the assumption that the response is zero when all the > predictors are zero. If I still want to perform a regression in that > conditions, does R have any options to evaluate the model adequacy > correctly? > > Thanks in advance, > > Leonardo Trujillo. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >---------- This mail has been sent through the MPI for Demographic Rese...{{dropped}}
Trujillo L. skreiv:> Sorry for the naiveness of my question but I have been trying in the > R-help and the CRAN website without any success. I am trying to perform > a regression through the origin (without intercept) and my main concern > is about its evaluative statistics. It is clear for me that R squared > does not make sense if you do not have an intercept in your modelThere are many different definitions of R?. Most of them are equivalent *only* for the simple linear regression model, y = a + b ? x + ?. R (the program) use a different formula for calculating R? when you fit a regression through the origin than for a simple linear regression; and the definition used *does* make sense. (Some other statistics software use the same definition in the two cases, which makes the resulting statistic meaningless in the case of regression through the origin.) The (IHMO) most sensible way to interprete R? is as the proportional reduction in variation when fitting a more complex model over fitting a simpler model. See this excellent paper for a thorough discussion: Anderson-Sprecher R. (1994). ?Model comparisons and R??. The American Statistician, volume 48, number 2, pages 113?117. And for a discussion of the different definitions of R?, especially when using transformed variables, see: Kv?lseth T.O. (1985). ?Cautionary note about R??. The American Statistician, volume 39, number 4, pages 279?285.> If I still want to perform a regression in that > conditions, does R have any options to evaluate the model adequacy > correctly?Try some diagnostic plots: x = rnorm(100) y = 1 + x + rnorm(100) l=lm(y~x-1) # Note: Wrong model (we need an intercept)! summary(l) par(mfrow=c(2,2)) plot(l) As you can see, the fit is not very good. You might also want to try: plot(y~x) abline(l,col="red") -- Karl Ove Hufthammer