Computes mean absolute error (MAE), mean squared error (MSE), mean percentage error (MPE), symmetric mean absolute percentage error (sMAPE), mean absolute percentage error (MAPE), mean absolute scaled error (MASE), mean relative absolute error (MRAE), geometric mean relative absolute error (GMRAE), mean bounded relative absolute error (MBRAE), unscaled MBRAE (UMBRAE) for distributed lag models.
See Chen et al. (2017) for the definitions of MSE, MAE, MAPE, sMAPE, MRAE, GMRAE, MBRAE, UMBMRAE.
Let et=Yt−Y^t be the one-step-ahead forecast error. Then, a scaled error is defined as
qt=n−11∑i=2n∣Yi−Yi−1∣et,
which is independent of the scale of the data. Mean absolute scaled error is defined as
MASE=mean(∣qt∣)
(Hyndman and Koehler, 2006).
Fitted models would be finite, polynomial, Koyck, ARDL DLMs, or linear model fitted with lm() function. This function also computes MASE values of multiple models when fed at the same time.
Chen, C., Twycross, J., Garibaldi, J.M. (2017). A new accuracy measure based on bounded relative error for time series forecasting. PLoS ONE, 12(3), e0174202.
Hyndman, R.J. and Koehler, A.B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22, 679-688.
Examples
## Not run:data(seaLevelTempSOI)# Fit a bunch of polynomial DLMsmodel.poly1 = polyDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, q =2, k =2, show.beta =TRUE)model.poly2 = polyDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, q =3, k =2, show.beta =TRUE)model.poly3 = polyDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, q =4, k =2, show.beta =TRUE)MASE(model.poly1, model.poly2, model.poly3)# Fit a bunch of finite DLMsmodel.dlm1 = dlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, q =2)model.dlm2 = dlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, q =3)model.dlm3 = dlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, q =4)MASE(model.dlm1, model.dlm2, model.dlm3)MBRAE(model.dlm1, model.dlm2, model.dlm3)GoF(model.dlm1, model.dlm2, model.dlm3)# Fit a linear modelmodel.lm = lm(GMSL ~ LandOcean , data = seaLevelTempSOI)MASE(model.lm)GoF(model.lm)# Fit a Koyck modelmodel.koyck = koyckDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL)MASE(model.koyck)GoF(model.koyck)# Fit a bunch of ARDLsmodel.ardl1 = ardlDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, p=1, q=2)model.ardl2 = ardlDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, p=2, q=2)model.ardl3 = ardlDlm(x = seaLevelTempSOI$LandOcean, y = seaLevelTempSOI$GMSL, p=3, q=2)MASE(model.ardl1 , model.ardl2 , model.ardl3)GoF(model.ardl1 , model.ardl2 , model.ardl3)# Find MASEs of different model objectsMASE(model.ardl1 , model.dlm1 , model.poly1, model.lm)GoF(model.ardl1 , model.dlm1 , model.poly1, model.lm)## End(Not run)