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.
Using the example from lm help page: summary(lm.D9)$r.squared See str(summary(lm.D9)) for more options. On Fri, Jul 10, 2009 at 7:01 PM, Agus Susanto <gusanto@gmail.com> 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. > > ______________________________________________ > 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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
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. > > ______________________________________________ > 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. >-- Greg Hirson ghirson at ucdavis.edu Graduate Student Agricultural and Environmental Chemistry 1106 Robert Mondavi Institute North One Shields Avenue Davis, CA 95616