[R] Extract R-squared from summary of lm

Paul Hiemstra p.hiemstra at geo.uu.nl
Fri Jan 22 16:17:51 CET 2010


Trafim Vanishek wrote:
> Dear all,
>
> I cannot find to explicitly get the R-squared or adjusted R-squared from
> summary(lm())
>
> Thanks a lot!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>   
See the documentation for summary.lm (?summary.lm):

summary(lm(speed~dist, cars))
attributes(summary(lm(speed~dist, cars)))

# Get the R^2
summary(lm(speed~dist, cars))$r.squared
summary(lm(speed~dist, cars))$adj.r.squared

cheers,
Paul

-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



More information about the R-help mailing list