Learn R Programming

smooth (version 2.4.1)

MPE: Error measures

Description

Functions allow to calculate different types of errors:

  1. MPE - Mean Percentage Error,

  2. MAPE - Mean Absolute Percentage Error,

  3. SMAPE - Symmetric Mean Absolute Percentage Error,

  4. MASE - Mean Absolute Scaled Error,

  5. RelMAE - Average Relative Mean Absolute Error,

  6. sMSE - Scaled Mean Squared Error,

  7. sPIS- Scaled Periods-In-Stock,

  8. sCE - Scaled Cumulative Error.

Usage

MPE(actual, forecast, digits = 3)

MAPE(actual, forecast, digits = 3)

SMAPE(actual, forecast, digits = 3)

MASE(actual, forecast, scale, digits = 3)

RelMAE(actual, forecast, benchmark, digits = 3)

sMSE(actual, forecast, scale, digits = 3)

sPIS(actual, forecast, scale, digits = 3)

sCE(actual, forecast, scale, digits = 3)

Arguments

actual

The vector or matrix of actual values.

forecast

The vector or matrix of forecasts values.

digits

Number of digits of the output.

scale

The value that should be used in the denominator of MASE. Can be anything but advised values are: mean absolute deviation of in-sample one step ahead Naive error or mean absolute value of the in-sample actuals.

benchmark

The vector or matrix of the forecasts of the benchmark model.

Value

All the functions return the scalar value.

Details

In case of sMSE, scale needs to be a squared value. Typical one -- squared mean value of in-sample actuals.

References

  • Fildes, R. (1992). The evaluation of extrapolative forecasting methods. International Journal of Forecasting, 8, pp.81-98.

  • Hyndman R.J., Koehler A.B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22, pp.679-688.

  • Makridakis, S. (1993). Accuracy measures: Theoretical and practical concerns. International Journal of Forecasting, 9, pp.527-529.

  • Petropoulos F., Kourentzes N. (2015). Forecast combinations for intermittent demand. Journal of the Operational Research Society, 66, pp.914-924.

  • Wallstrom P., Segerstedt A. (2010). Evaluation of forecasting error measurements and techniques for intermittent demand. International Journal of Production Economics, 128, pp.625-636.

Examples

Run this code
# NOT RUN {

y <- rnorm(100,10,2)
esmodel <- es(y[1:90],model="ANN",h=10)

MPE(y[91:100],esmodel$forecast,digits=5)
MAPE(y[91:100],esmodel$forecast,digits=5)
SMAPE(y[91:100],esmodel$forecast,digits=5)
MASE(y[91:100],esmodel$forecast,mean(abs(y[1:90])),digits=5)
MASE(y[91:100],esmodel$forecast,mean(abs(diff(y[1:90]))),digits=5)

esmodel2 <- es(y[1:90],model="AAN",h=10)
RelMAE(y[91:100],esmodel2$forecast,esmodel$forecast,digits=5)

MASE(y[91:100],esmodel$forecast,mean(abs(y[1:90]))^2,digits=5)

sMSE(y[91:100],esmodel$forecast,mean(abs(y[1:90])),digits=5)
sPIS(y[91:100],esmodel$forecast,mean(abs(y[1:90])),digits=5)
sCE(y[91:100],esmodel$forecast,mean(abs(y[1:90])),digits=5)

# }

Run the code above in your browser using DataLab