[R] Coefficient of determination when intercept is zero
endeitz
endeitz at yahoo.com
Thu Jan 18 06:53:12 CET 2007
Thanks for the guidance. With the help of your explanation, I was able to
find this reference that provides a good explanation of why the definition
may be different in the "no intercept" or "regression through origin" case.
For future readers of this list, the reference is:
Joseph G. Eisenhauer (2003)
Regression through the Origin
Teaching Statistics 25 (3), 76–80.
doi:10.1111/1467-9639.00136
Cheers,
Ed.
Prof Brian Ripley wrote:
>
> This is documented on ?summary.lm.
>
> It is not that 'intercept is zero' or 'zero intercept', it is that there
> is no intercept term in the model.
>
> On Wed, 17 Jan 2007, endeitz wrote:
>
>>
>> I am curious as to the "lm" calculation of R2 (multiple coefficient of
>> determination, I assume) when intercept is zero. I have 18 data points,
>> two
>> independent variables:
>>
>> First, a model with an intercept:
>>
>>> mod0=lm(Div~Rain+Evap,data=test)
>>> summary(mod0)$r.squared
>> [1] 0.6257541
>>> cor(predict(mod0),test$Div)^2
>> [1] 0.6257541
>>
>> The $r.squared and the result from "cor" are the same, as I would expect.
>>
>> Now we try a model with zero intercept:
>>
>>> mod1=lm(Div~0+Rain+Evap,data=test)
>>> summary(mod1)$r.squared
>> [1] 0.9099358
>>> cor(predict(mod1),test$Div)^2
>> [1] 0.5813659
>>
>> Why has the $r.squared value increased to 0.9? And now the result from
>> "cor" is not the same? Is there a special way to calculate the
>> coefficient
>> of determination when the intercept is zero?
>>
>> Cheers,
>>
>> Ed.
>>
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/Coefficient-of-determination-when-intercept-is-zero-tf3030776.html#a8425379
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list