Re: [R] Strange R squared, possible error

From: Bert Gunter <gunter.berton_at_gene.com>
Date: Wed, 16 Mar 2011 13:40:55 -0700

?summary.lm

The R^2 section explains that R^2 is computed differently depending on whether or not an intercept is in the model.

On Wed, Mar 16, 2011 at 12:49 PM, derek <jan.kacaba_at_gmail.com> wrote:
> k=lm(y~x)
> summary(k)
> returns R^2=0.9994
>
> lm(y~x) is supposed to find coef. a anb b in y=a*x+b
>
> l=lm(y~x+0)
> summary(l)
> returns R^2=0.9998
> lm(y~x+0) is supposed to find coef. a in y=a*x+b while setting b=0
>
> The question is why do I get better R^2, when it should be otherwise?
>
> Im sorry to use the word "MS exel" here, but I verified it in exel and it
> gives:
> R^2=0.9994 when y=a*x+b is used
> R^2=0.99938 when y=a*x+0 is used
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Strange-R-squared-possible-error-tp3382818p3382818.html
> Sent from the R help mailing list archive at Nabble.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.
>

-- 
Bert Gunter
Genentech Nonclinical Biostatistics

______________________________________________
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 Wed 16 Mar 2011 - 20:52:27 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 Wed 16 Mar 2011 - 21:50:21 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