Learn R Programming

sjmisc (version 1.8)

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

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