Produce indices of model performance for linear models

# S3 method for lm
performance(x, data, digits = 4, ...)

Arguments

x

an object of class "lm".

data

a data frame. If no data frame is provided, the model training data is used.

digits

integer; number of digits to print (default=4).

...

not currently used

Value

A vector of performance statistics (RMSE, Rsquared, and MAE).

Details

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.

See also

Examples

# 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