Learn R Programming

smooth (version 1.6.3)

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 Rellative Mean Absolute Error,
  6. sMSE - Scaled Mean Squared Error,
  7. sPIS- Scaled Periods-In-Stock,
  8. sCE - Scaled Cumulative Error.
In case of sMSE, scale needs to be a squared value. Typical one -- squared mean value of in-sample actuals.

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.
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.
digits
Number of digits of the output.

Value

All the functions return the scalar value.

References

  • Fildes, R. (1992). The evaluation of extrapolative forecasting methods. International Journal of Forecasting, 8, pp.81-98.
  • Makridakis, S. (1993). Accuracy measures: Theoretical and practical concerns. International Journal of Forecasting, 9, pp.527-529.
  • Hyndman R.J., Koehler A.B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22, pp.679-688.
  • Petropoulos F., Kourentzes N. (2015). Forecast combinations for intermittent demand. Journal of the Operational Research Society, 66, pp.914-924.

Examples

Run this code

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