[R] extract R-squared and P-value from lm results

2010-01-29 Thread wenjun zheng
Hi, R Users I find a problem in extracting the R-squared and P-value from the lm results described below (in Italic), *Residual standard error: 2.25 on 17 degrees of freedom* *Multiple R-squared: 0.001069, Adjusted R-squared: -0.05769 * *F-statistic: 0.01819 on 1 and 17 DF, p-value: 0.8943 *

Re: [R] extract R-squared and P-value from lm results

2010-01-29 Thread Chuck Cleland
On 1/29/2010 9:04 AM, wenjun zheng wrote: Hi, R Users I find a problem in extracting the R-squared and P-value from the lm results described below (in Italic), *Residual standard error: 2.25 on 17 degrees of freedom* *Multiple R-squared: 0.001069, Adjusted R-squared: -0.05769 *

Re: [R] extract R-squared and P-value from lm results

2010-01-29 Thread Dennis Murphy
x - 1:10 y - 2 + 1.5 * rnorm(10, x, 2) m - lm(y ~ x) summary(m)$r.squared [1] 0.6056889 anova(m)$'Pr(F)' [1] 0.0080142NA Components of the summary() and anova() methods of lm() can be extracted. See names(summary(m)) names(anova(m)) to see the components one can extract. HTH,

Re: [R] extract R-squared and P-value from lm results

2010-01-29 Thread wenjun zheng
Thanks, I get it. Wenjun, ZHENG 2010/1/29 Dennis Murphy djmu...@gmail.com x - 1:10 y - 2 + 1.5 * rnorm(10, x, 2) m - lm(y ~ x) summary(m)$r.squared [1] 0.6056889 anova(m)$'Pr(F)' [1] 0.0080142NA Components of the summary() and anova() methods of lm() can be extracted. See