[R] R-squared value for linear regression passing through origin using lm()

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Thu Oct 18 13:20:48 CEST 2007

On Thu, 18 Oct 2007, Toffin Etienne wrote:

> Hi,
> A have small technical question about the calculation of R-squared
> using lm().
> In a study case with experimental values, it seems more logical to
> force the regression line to pass through origin with lm(y ~ x +0).
> However, R-squared  values are higher in this case than when I
> compute the linear regression with lm(y ~ x).
> It seems to be surprising to me: is this result normal ? Is there any
> problem in the R-squared value calculated in this case ?

Have you considered reading the documentation? ?summary.lm has

  r.squared: R^2, the 'fraction of variance explained by the model',

                R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2),

            where y* is the mean of y[i] if there is an intercept and
            zero otherwise.

> Thanks,
> Etienne Toffin
> -------------------------------------------------------------------
> Etienne Toffin, PhD Student
> Unit of Social Ecology
> Université Libre de Bruxelles, CP 231
> Boulevard du Triomphe
> B-1050 Brussels
> Belgium
> http://www.ulb.ac.be/sciences/use/toffin.html
> 	[[alternative HTML version deleted]]

More information about the R-help mailing list