Learn R Programming

sjstats (version 0.2.0)

rmse: Root Mean Squared Error (RMSE)

Description

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

Usage

rmse(fit, normalized = FALSE)

Arguments

fit
Fitted linear model of class lm, merMod (lme4) or lme (nlme).
normalized
Logical, use TRUE if normalized rmse should be returned.

Value

The root mean squared error of fit; or the normalized root mean squared error of fit if normalized = TRUE.

References

See Also

cv for the coefficient of variation, and rse for the residual standard error.

Examples

Run this code
data(efc)
fit <- lm(barthtot ~ c160age + c12hour, data = efc)
rmse(fit)

library(lme4)
fit <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
rmse(fit)

# normalized RMSE
library(nlme)
fit <- lme(distance ~ age, data = Orthodont)
rmse(fit, normalized = TRUE)

Run the code above in your browser using DataLab