forecTheta (version 1.0)

forecTheta-package: Forecasting Time Series by Theta Method

Description

In this package we implemented functions for forecast univariate time series using the Optimised Theta Method of Fioruci et al (2015) and the Standard Theta Method of Assimakopoulos & Nikolopoulos (2000). Moreover, it is including a function for compute the main errors metrics used in time series forecasting and a function for compute the Generalised Rolling Origin Evaluation, which contain as particular cases the Rolling Origin Evaluation and the Fixed Origin Evaluation of Tashman (2000).

Arguments

Details

ll{ Package: forecTheta Type: Package Version: 1.0 Date: 2015-03-30 License: GPL (>=2.0) } otm(y, h, seasonal=FALSE, theta=NULL) thetaM(y, h, seasonal=FALSE) errorMetric(obs, forec, type = "sAPE", statistic = "M") groe(y, forecFunction = ses, g = "sAPE", n1 = length(y)-10)

References

Fioruci J.A., Pellegrini T.R., Louzada F., Petropoulos F. (2015). The Optimised Theta Method. Free available at http://arxiv.org/abs/1503.03529. Assimakopoulos, V. and Nikolopoulos k. (2000). The theta model: a decomposition approach to forecasting. International Journal of Forecasting 16, 4, 521--530. Tashman, L.J. (2000). Out-of-sample tests of forecasting accuracy: an analysis and review. International Journal of Forecasting 16 (4), 437--450.

See Also

otm, thetaM, groe, rolOrig, fixOrig, errorMetric

Examples

Run this code
##############################################################	

y1 = 2+ 0.15*(1:20) + rnorm(20,2)
y2 = y1[20]+ 0.3*(1:30) + rnorm(30,2)
y =  as.ts(c(y1,y2))

otm.fit <- otm(y=as.ts(y[1:40]), h=10)
plot(y)
points(otm.fit$fitted, type = "l")
points(otm.fit$mean, type = "l", col="blue")

theta.fit <- thetaM(y=as.ts(y[1:40]), h=10)

### sMAPE metric
errorMetric(obs=as.ts(y[41:50]), forec=otm.fit$mean, type = "sAPE", statistic = "M")
errorMetric(obs=as.ts(y[41:50]), forec=theta.fit$mean, type = "sAPE", statistic = "M")

### sMdAPE metric
errorMetric(obs=as.ts(y[41:50]), forec=otm.fit$mean, type = "sAPE", statistic = "Md")
errorMetric(obs=as.ts(y[41:50]), forec=theta.fit$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=otm.fit$mean, type = "AE", statistic = "M") / meanDiff1
errorMetric(obs=as.ts(y[41:50]), forec=theta.fit$mean, type = "AE", statistic = "M") / meanDiff1

Run the code above in your browser using DataLab