rmse: Computes the RMSE score.

View source: R/rmse.R

rmseR Documentation

Computes the RMSE score.

Description

Returns the RMSE.

Usage

rmse(x)

Arguments

x

a numerical vector of residuals.

Details

Used for forecast evaluation evaluation and optimization of parameters in model fitting.

Note that NAs are ignored (i.e. mean is called with na.rm=TRUE).

Value

The RMSE score.

See Also

score() for calculation of a score for the k'th horizon

Examples



 # Just a vector to be forecasted
 y <- c(filter(rnorm(100), 0.95, "recursive"))
 # Generate a forecast matrix with a simple persistence model
 Yhat <- persistence(y, kseq=1:4)
 # The residuals for each horizon
 Resid <- residuals(Yhat, y)

# Calculate the score for the k1 horizon
rmse(Resid$h1)

# For all horizons
apply(Resid, 2, rmse)



onlineforecast documentation built on Oct. 12, 2023, 5:15 p.m.