error | R Documentation |
Computes the forecast error measure.
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)
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 |
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.
A numeric value.
Han Lin Shang
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.