Learn R Programming

sjmisc (version 1.0.2)

rmse: Compute root mean squared error (RMSE)

Description

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

Usage

rmse(fit, normalized = FALSE)

Arguments

fit
a 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

  • http://en.wikipedia.org/wiki/Root-mean-square_deviation{Wikipedia: RMSD}
  • http://www.theanalysisfactor.com/assessing-the-fit-of-regression-models/{Grace-Martin K: Assessing the Fit of Regression Models}

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) # random is ~ age
rmse(fit, normalized = TRUE)

Run the code above in your browser using DataLab