performance.lm.Rd
Produce indices of model performance for linear models
# S3 method for lm
performance(x, data, digits = 4, ...)
an object of class "lm"
.
a data frame. If no data frame is provided, the model training data is used.
integer; number of digits to print (default=4).
not currently used
A vector of performance statistics (RMSE, Rsquared, and MAE).
performance
calculates the r-squared, root mean square error (RMSE),
and mean absolute error (MAE) when applying the given linear model to a
data frame. If a data frame is not specified, the model is evaluated on the
training data (i.e., resubstitution). Results are provided by the
postResample
function from the caret package.
# performance on training sample
fit <- lm(mpg ~ hp + wt + accel + origin, data = auto_mpg)
performance(fit)
#> Multiple Regression Performance
#> Data: auto_mpg
#> N: 388
#>
#> Model: lm(formula = mpg ~ hp + wt + accel + origin, data = auto_mpg)
#>
#> RMSE Rsquared MAE
#> 4.1385 0.7184 3.1518