Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

error

Forecast error measure


Description

Computes the forecast error measure.

Usage

error(forecast, forecastbench, true, insampletrue, method = c("me", "mpe", "mae", 
 "mse", "sse", "rmse", "mdae", "mdse", "mape", "mdape", "smape", 
  "smdape", "rmspe", "rmdspe", "mrae", "mdrae", "gmrae", 
   "relmae", "relmse", "mase", "mdase", "rmsse"), giveall = FALSE)

Arguments

forecast

Out-of-sample forecasted values.

forecastbench

Forecasted values using a benchmark method, such as random walk.

true

Out-of-sample holdout values.

insampletrue

Insample values.

method

Method of forecast error measure.

giveall

If giveall = TRUE, all error measures are provided.

Details

Bias measure:

If method = "me", the forecast error measure is mean error.

If method = "mpe", the forecast error measure is mean percentage error.

Forecast accuracy error measure:

If method = "mae", the forecast error measure is mean absolute error.

If method = "mse", the forecast error measure is mean square error.

If method = "sse", the forecast error measure is sum square error.

If method = "rmse", the forecast error measure is root mean square error.

If method = "mdae", the forecast error measure is median absolute error.

If method = "mape", the forecast error measure is mean absolute percentage error.

If method = "mdape", the forecast error measure is median absolute percentage error.

If method = "rmspe", the forecast error measure is root mean square percentage error.

If method = "rmdspe", the forecast error measure is root median square percentage error.

Forecast accuracy symmetric error measure:

If method = "smape", the forecast error measure is symmetric mean absolute percentage error.

If method = "smdape", the forecast error measure is symmetric median absolute percentage error.

Forecast accuracy relative error measure:

If method = "mrae", the forecast error measure is mean relative absolute error.

If method = "mdrae", the forecast error measure is median relative absolute error.

If method = "gmrae", the forecast error measure is geometric mean relative absolute error.

If method = "relmae", the forecast error measure is relative mean absolute error.

If method = "relmse", the forecast error measure is relative mean square error.

Forecast accuracy scaled error measure:

If method = "mase", the forecast error measure is mean absolute scaled error.

If method = "mdase", the forecast error measure is median absolute scaled error.

If method = "rmsse", the forecast error measure is root mean square scaled error.

Value

A numeric value.

Author(s)

Han Lin Shang

References

P. A. Thompson (1990) "An MSE statistic for comparing forecast accuracy across series", International Journal of Forecasting, 6(2), 219-227.

C. Chatfield (1992) "A commentary on error measures", International Journal of Forecasting, 8(1), 100-102.

S. Makridakis (1993) "Accuracy measures: theoretical and practical concerns", International Journal of Forecasting, 9(4), 527-529.

R. J. Hyndman and A. Koehler (2006) "Another look at measures of forecast accuracy", International Journal of Forecasting, 22(3), 443-473.

Examples

# Forecast error measures can be categorized into three groups: (1) scale-dependent, 
# (2) scale-independent but with possible zero denominator, 
# (3) scale-independent with non-zero denominator.
error(forecast = 1:2, true = 3:4, method = "mae")
error(forecast = 1:5, forecastbench = 6:10, true = 11:15, method = "mrae")
error(forecast = 1:5, forecastbench = 6:10, true = 11:15, insampletrue = 16:20, 
	giveall = TRUE)

ftsa

Functional Time Series Analysis

v6.0
GPL-3
Authors
Rob Hyndman [aut] (<https://orcid.org/0000-0002-2140-5352>), Han Lin Shang [aut, cre, cph] (<https://orcid.org/0000-0003-1769-6430>)
Initial release
2020-11-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.