| rSquared {NCStats} | R Documentation |
Extracts the coefficient of determination (i.e.,
“r-squared” from a linear model (i.e., lm)
object.
rSquared(x, digits = getOption("digits"),
percent = FALSE)
x |
An object saved from |
digits |
A number indicating the number of digits to round the returned result to. |
percent |
A logical indicating if the result should
be returned as a percentage ( |
This is a convenience function for extracting the
r.squared part from summary(lm).
Returns a number representing the coefficient of determination as either a proportion or percentage.
data(Mirex) # Simple linear regression test HA:slope!=0.1 lm1 <- lm(mirex~weight, data=Mirex) rSquared(lm1) rSquared(lm1,digits=3) rSquared(lm1,digits=1,percent=TRUE)