From: endeitz <endeitz_at_yahoo.com>

Date: Wed 17 Jan 2007 - 22:18:53 GMT

Date: Wed 17 Jan 2007 - 22:18:53 GMT

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:

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.

-- View this message in context: http://www.nabble.com/Coefficient-of-determination-when-intercept-is-zero-tf3030776.html#a8420811 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.Received on Thu Jan 18 09:46:07 2007

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 18 Jan 2007 - 04:30:23 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.
*