CommonForecastingErrors: Common Forecasting Errors

View source: R/CommonForecastingErrors.R

CommonForecastingErrorsR Documentation

Common Forecasting Errors

Description

Calculate common forecasting errors

Usage

CommonForecastingErrors(TestdataY,ForecastingF,

epsilon=10^-4,na.rm=TRUE,stepsize=1,digits)

Arguments

TestdataY

[1:n] numerical vector of test data

ForecastingF

[1:n] numerical vector of forecast

epsilon

Optional, epsilon defining when zero values should be approximated. Default is 10^-4

na.rm

Optional, removing missing values. Default is TRUE

stepsize

Optional, for mase. See mase

digits

Optional, number of digits for the output values to which the results will be scientifically rounded to (and not by R logic)

Details

MAE: Mean Absolute Error given as \frac{1}{T} \sum_{t=1}^{T} |Y_t - F_t|

MAPE: Mean Absolute Percentage Error given as \frac{1}{T} \sum_{t=1}^{T} |\frac{Y_t - F_t}{Y_t}|

SMAPE: Symmetric Mean Absolute Percentage Error given as \frac{100}{T} * \frac{1}{T} \sum_{t=1}^{T} \frac{|Y_t-X_t|}{|X_t|+|Y_t|}. See also SMAPE

MASE: Mean Absolute Scaled Error given as \frac{T}{T-s}*\frac{|Y_t - F_t|}{\sum_{t=s}^{T}|Y_t - Y_{t-s}|} where s is the stepsize. See also mase

RMSE: Root Mean Square Error given as \sqrt{\sum_{t=1}^{T} \frac{(Y_t - F_t)^2}{T}}. See also rsme

BIAS: Value between -1 and 1 given as 1 - \frac{4}{\pi}\text{arctan}(\frac{b}{a}), where b is the sum of all errors Y_t - F_t < 0 and a is the sum of all errors Y_t - F_t \geq 0. See also RootDeviance

MRD: Mean Root Deviance given as \frac{1}{T}\sum_{t=1}^{T}\sqrt{Y_t - F_t}. See also RootDeviance

Value

Named vector with forecasting error values for:

'MAE','MAPE','SMAPE','MASE','RMSE','BIAS','MRD'

Author(s)

Michael Thrun

References

to be filled

Examples

Y=runif(10)
FOR=runif(10)
CommonForecastingErrors(Y,FOR)

Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.