Rsq: Multiple R-squared

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Rsq.R

Description

Function to calculate the multiple R-squared and the adjusted R-squared from a fitted model via lm or aov, i.e., linear models. For a model fitted via nls, nonlinear models, the pseudo R-squared is returned.

Usage

1
 Rsq(model) 

Arguments

model

a model fitted via lm, aov or nls.

Value

A list of

R.squared

the multiple R-squared (for linear models) or the Pseudo R-squared (for nonlinear models).

adj.R.squared

the adjusted R-squared.

Author(s)

Anderson Rodrigo da Silva <anderson.agro@hotmail.com>

See Also

lm, summary.lm, aov, nls

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# example 1 [linear model]
y <- rnorm(10)
x <- 1:10
fit <- lm(y ~ x)
summary(fit)
Rsq(fit)

# example 2 [nonlinear model for Load Bearing Capacity]
data(compaction)
attach(compaction)
out <- fitlbc(theta = Mois, sigmaP = PS)
summary(out)
Rsq(out)

# End (not run)

soilphysics documentation built on Jan. 13, 2021, 7:06 p.m.