Agus,

Take a look at the summary method for lm - ?summary.lm

x = 1:10
y = 2*x + rnorm(10)

summary(lm(y~x))
names(summary(lm(y~x)))
summary(lm(y~x))$r.squared
#  [1] 0.9892822


Hope that helps,

Greg


Agus Susanto wrote:
Dear all,
I know there are 'coef', 'predict', 'fit' to get the corresponding
outputs. Is that possible to get the value of R-squared from a 'lm'
output?
Many thanks.

______________________________________________
[email protected] 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.

--
Greg Hirson
[email protected]

Graduate Student
Agricultural and Environmental Chemistry

1106 Robert Mondavi Institute North
One Shields Avenue
Davis, CA 95616

______________________________________________
[email protected] 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.

Reply via email to