Compute root mean squared error for (mixed effects) models, including Bayesian regression models.
Usage
performance_rmse(model, normalized = FALSE, verbose = TRUE)
rmse(model, normalized = FALSE, verbose = TRUE)
Arguments
- model
A model.
- normalized
Logical, use
TRUE
if normalized rmse should be returned.- verbose
Toggle off warnings.
Details
The RMSE is the square root of the variance of the residuals and indicates the absolute fit of the model to the data (difference between observed data to model's predicted values). It can be interpreted as the standard deviation of the unexplained variance, and is in the same units as the response variable. Lower values indicate better model fit.
The normalized RMSE is the proportion of the RMSE related to the range of the response variable. Hence, lower values indicate less residual variance.
Examples
if (require("nlme")) {
m <- lme(distance ~ age, data = Orthodont)
# RMSE
performance_rmse(m, normalized = FALSE)
# normalized RMSE
performance_rmse(m, normalized = TRUE)
}
#> Loading required package: nlme
#>
#> Attaching package: ‘nlme’
#> The following object is masked from ‘package:lme4’:
#>
#> lmList
#> [1] 0.07242178