Learn R Programming

performance (version 0.1.0)

rmse: Root Mean Squared Error of Linear Models

Description

Compute root mean squared error for linear (mixed effects) models.

Usage

rmse(model, normalized = FALSE)

Arguments

model

Linear model of class lm, merMod (lme4) or lme (nlme).

normalized

Logical, use TRUE if normalized rmse should be returned.

Value

Numeric, the root mean squared error.

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

Run this code
# NOT RUN {
library(nlme)
m <- lme(distance ~ age, data = Orthodont)

# RMSE
rmse(m, normalized = TRUE)

# normalized RMSE
rmse(m, normalized = TRUE)

# }

Run the code above in your browser using DataLab