Re: [R] Strange R squared, possible error

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu, 17 Mar 2011 20:38:21 -0400

On Thu, Mar 17, 2011 at 8:22 PM, Berwin A Turlach <berwin_at_maths.uwa.edu.au> wrote:
> G'day Gabor,
>
> On Thu, 17 Mar 2011 11:36:38 -0400
> Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:
>
>> The idea is that if you have a positive quantity that can be broken
>> down into two nonnegative quantities: X = X1 + X2 then it makes sense
>> to ask what proportion X1 is of X.   For example: 10 = 6 + 4 and 6 is
>> .6 of the total.
>>
>> Now, in the case of a model with an intercept its a mathematical fact
>> that the variance of the response equals the variance of the fitted
>> model plus the variance of the residuals.  Thus it makes sense to ask
>> what fraction of the variance of the response is represented by the
>> variance of the fitted model (this fraction is R^2).
>>
>> But if there is no intercept then that mathematical fact breaks down.
>> That is, its no longer true that the variance of the response equals
>> the variance of the fitted model plus the variance of the residuals.
> [...]
>
> Do you have any reference to back this up, as I am somewhat surprised.
>
> I know that if there is no intercept in the model, then the residuals
> may not add to zero, but we are still doing least-squares, i.e. the
> fitted values are orthogonal to the residual vector and the variance of
> the response is the sum of the variance of the fitted model plus the
> variance of the residuals.
>
> Or am I missing something?

>

Try it on an example to convince yourself:

> fm <- lm(demand ~ Time, BOD)
> var(fitted(fm)) + var(resid(fm)) - var(BOD$demand)
[1] 3.552714e-15
>
> fm0 <- lm(demand ~ Time - 1, BOD)
> var(fitted(fm0)) + var(resid(fm0)) - var(BOD$demand)

[1] 59.28969

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.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.
Received on Fri 18 Mar 2011 - 00:44:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Mar 2011 - 01:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive