On Oct 12, 2010, at 9:01 AM, Vittorio Colagrande wrote:
Dear R-group,
We have begun to use it for teaching Statistics. In this context we
have run into a problem with linear regression
where we found the results of are confusing.
Specifically, considering the data:
x=c(4,5,6,3,7,8,10,14,13,15,6,7,8,10,11,4,5,17,12,11)
y=c(rep(7,20))
#and settings
regress=lm(y~x)
summary(regress) gives the following results:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.000e+00 8.623e-17 8.118e+16 <2e-16 ***
x -1.116e-17 8.956e-18 -1.247e+00 0.229
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.565e-16 on 18 degrees of freedom
Multiple R-squared: 0.6416, Adjusted R-squared: 0.6217
Other statistical packages respond that the analysis can not be
done. We think that the results of R-squared does not seem to
express the variability of y explained by x. We would greatly
appreciate any clarification you could provide.
It is expressing the degree to which the estimate of the intercept
"explains" the tendency of the data to be away from the null
hypothesis of y=0. Consider what you get from two (equivalent to each
other) lm calls:
> regress2=lm( I(y-7)~x )
> summary(regress2)
Call:
lm(formula = I(y - 7) ~ x)
Residuals:
Min 1Q Median 3Q Max
0 0 0 0 0
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0 0 NA NA
x 0 0 NA NA
Residual standard error: 0 on 18 degrees of freedom
Multiple R-squared: NaN, Adjusted R-squared: NaN
F-statistic: NaN on 1 and 18 DF, p-value: NA
> y2=y-7
> regress2=lm( y2~x )
> summary(regress2)
Call:
lm(formula = y2 ~ x)
Residuals:
Min 1Q Median 3Q Max
0 0 0 0 0
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0 0 NA NA
x 0 0 NA NA
Residual standard error: 0 on 18 degrees of freedom
Multiple R-squared: NaN, Adjusted R-squared: NaN
F-statistic: NaN on 1 and 18 DF, p-value: NA
--
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@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.