err: Common error metrics

Description Usage Arguments Details References Examples

View source: R/multiCV.R

Description

Common error metrics

Usage

1
err(y, yhat, wt = 1, method = c("MAE", "RMSE", "MdAE"))

Arguments

y, yhat

vectors of true and predicted values.

wt

weights for observations, uniform by default.

method

vector of names of error metrics to compute.

Details

The following error metrics are implemented:

method function
ME mean(y-yhat)
MAE mean(abs(y-yhat))
RMSE sqrt(mean((y-yhat)^2))
MAPE mean(abs((y-yhat)/y))
MdAE median(abs(y-yhat))
RMdSE sqrt(median((y-yhat)^2))
MdAPE median(abs((y-yhat)/y))
MRAE mean(abs(y-yhat))/mean(abs(mean(y)-y))
MRRSE mean((y-yhat)^2)/mean((mean(y)-y)^2)
wME mean((y-yhat) * wt)
wMAE mean(abs(y-yhat) * wt)
wRMSE sqrt(mean((y-yhat)^2 * wt))

References

Shcherbakov, M. V., Brebels, A., Shcherbakova, N. L., Tyukov, A. P., Janovsky, T. A., & Kamaev, V. A. E. (2013). A survey of forecast error measures. World Applied Sciences Journal, 24, 171-176.

Examples

1
2
x <- rnorm(15)
err(x, mean(x))

twolodzko/twextras documentation built on May 3, 2019, 1:52 p.m.