forecTheta-Package | R Documentation |
In this package we implement functions for forecast univariate time series using the several Theta Models (Fiorucci et al, 2015 and 2016) and the Standard Theta Method of Assimakopoulos and Nikolopoulos (2000).
Package: | forecTheta |
Type: | Package |
Version: | 2.6.2 |
Date: | 2022-11-11 |
License: | GPL (>=2.0) |
dotm(y, h)
stheta(y, h)
errorMetric(obs, forec, type = "sAPE", statistic = "M")
groe(y, forecFunction = ses, g = "sAPE", n1 = length(y)-10)
Jose Augusto Fiorucci, Francisco Louzada
Maintainer: Jose Augusto Fiorucci <jafiorucci@gmail.com>
Fiorucci J.A., Pellegrini T.R., Louzada F., Petropoulos F., Koehler, A. (2016). Models for optimising the theta method and their relationship to state space models, International Journal of Forecasting, 32 (4), 1151–1161, <doi:10.1016/j.ijforecast.2016.02.005>.
Fioruci J.A., Pellegrini T.R., Louzada F., Petropoulos F. (2015). The Optimised Theta Method. arXiv preprint, arXiv:1503.03529.
Assimakopoulos, V. and Nikolopoulos k. (2000). The theta model: a decomposition approach to forecasting. International Journal of Forecasting 16, 4, 521–530, <doi:10.1016/S0169-2070(00)00066-2>.
Tashman, L.J. (2000). Out-of-sample tests of forecasting accuracy: an analysis and review. International Journal of Forecasting, 16 (4), 437–450, <doi:10.1016/S0169-2070(00)00065-0>.
dotm
, stheta
, otm.arxiv
,
groe
, rolOrig
, fixOrig
,
errorMetric
############################################################## y1 = 2+ 0.15*(1:20) + rnorm(20) y2 = y1[20]+ 0.3*(1:30) + rnorm(30) y = as.ts(c(y1,y2)) out <- dotm(y, h=10) summary(out) plot(out) out <- dotm(y=as.ts(y[1:40]), h=10) summary(out) plot(out) out2 <- stheta(y=as.ts(y[1:40]), h=10) summary(out2) plot(out2) ### sMAPE metric errorMetric(obs=as.ts(y[41:50]), forec=out$mean, type = "sAPE", statistic = "M") errorMetric(obs=as.ts(y[41:50]), forec=out2$mean, type = "sAPE", statistic = "M") ### sMdAPE metric errorMetric(obs=as.ts(y[41:50]), forec=out$mean, type = "sAPE", statistic = "Md") errorMetric(obs=as.ts(y[41:50]), forec=out2$mean, type = "sAPE", statistic = "Md") ### MASE metric meanDiff1 = mean(abs(diff(as.ts(y[1:40]), lag = 1))) errorMetric(obs=as.ts(y[41:50]), forec=out$mean, type = "AE", statistic = "M") / meanDiff1 errorMetric(obs=as.ts(y[41:50]), forec=out2$mean, type = "AE", statistic = "M") / meanDiff1 #### cross validation (2 origins) #groe( y=y, forecFunction = otm.arxiv, m=5, n1=40, p=2, theta=5) #groe( y=y, forecFunction = stheta, m=5, n1=40, p=2) #### cross validation (rolling origin evaluation) #rolOrig( y=y, forecFunction = otm.arxiv, n1=40, theta=5) #rolOrig( y=y, forecFunction = stheta, n1=40)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.