Learn R Programming

soilphysics (version 5.0)

Rsq: Multiple R-squared

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

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.

See Also

lm, summary.lm, aov, nls

Examples

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataLab