Bagged implementation (Bergmeir et al, 2016) of Dynamic Optimised Theta Model, Dynamic Standard Theta Model, Optimised Theta Model and Standard Theta Model (Fiorucci et al, 2016).
bagged_dotm(y, h=5, level=c(80,90,95), num_bootstrap = 100, bs_bootstrap = NULL,
s_type="multiplicative", s_test="default", lambda=NULL,
par_ini=c(y[1]/2, 0.5, 2), estimation=TRUE, lower=c(-1e+10, 0.1, 1.0),
upper=c(1e+10, 0.99, 1e+10), opt.method="Nelder-Mead")bagged_dstm(y, h=5, level=c(80,90,95), num_bootstrap = 100, bs_bootstrap = NULL,
s_type="multiplicative", s_test="default", lambda=NULL, par_ini=c(y[1]/2, 0.5),
estimation=TRUE, lower=c(-1e+10, 0.1), upper=c(1e+10, 0.99),
opt.method="Nelder-Mead")
bagged_otm(y, h=5, level=c(80,90,95), num_bootstrap = 100, bs_bootstrap = NULL,
s_type="multiplicative", s_test="default", lambda=NULL, par_ini=c(y[1]/2, 0.5, 2),
estimation=TRUE, lower=c(-1e+10, 0.1, 1.0), upper=c(1e+10, 0.99, 1e+10),
opt.method="Nelder-Mead")
bagged_stm(y, h=5, level=c(80,90,95), num_bootstrap = 100, bs_bootstrap = NULL,
s_type="multiplicative", s_test="default", lambda=NULL, par_ini=c(y[1]/2, 0.5),
estimation=TRUE, lower=c(-1e+10, 0.1), upper=c(1e+10, 0.99),
opt.method="Nelder-Mead")
An object of thetaModel class with one list containing the elements:
The name of the model/method
The original time series.
A binary indication for seasonal decomposition (original time series).
Seasonal decomposition type (original time series).
The optimisation method used in the optim() function.
The estimated values of (ell, alpha, theta) parameters (original time series)
The estimated weights values (original time series).
A time series element with the fitted points (original time series).
A time series element with the residual points (original time series).
The forecasting values calculed as the mean of bootstrapping simulations.
The forecasting values calculed as the median of bootstrapping simulations.
The levels for prediction intervals.
Lower limits for prediction intervals.
Upper limits for prediction intervals.
Object of time series class.
Number of required forecasting periods.
Levels for prediction intervals.
Number of bootstrap samples to be considered in the forecast (num argument of the forecast::bld.mbb.bootstrap function).
Block size for bootstrap samples to be considered in the forecast (block_size argument of the forecast::bld.mbb.bootstrap function). Used only if num_bootstrap >= 1.
Use "multiplicative" for the classic multiplicative seasonal decomposition,
"additive" for the classic additive seasonal decomposition and
"stl" for the STL decomposition (in this case, forecast::mstl is considered).
If TRUE, seasonal decomposition is used.
If FALSE, seasonal decomposition is not used.
If default, the time series is tested for statistically seasonal behaviour.
If uni_root, then first a difference is taken if a unit root is detected.
Parameter for Box-Cox transformation (forecast::BoxCox is considered).
If lambda=NULL, then it is ignored.
If lambda="auto", then this parameter is automatically selected (see forecast::BoxCox.lambda()).
Furthermore, lambda=0 corresponds to the logarithmic transformation, which can be used to get strictly positive forecasts.
Vector of initialization for (ell, alpha, theta) parameters.
If TRUE, the optim() function is consider for compute the minimum square estimator of parameters.
If FALSE, the models/methods are computed for par_ini values.
The lower limit of parametric space.
The upper limit of parametric space.
The numeric optimisation method for optim() function.
Choose one among 'Nelder-Mead', 'L-BFGS-B', 'SANN'.
Jose Augusto Fiorucci, Francisco Louzada, Igor De Oliveira Barros Faluhelyi.
This version allows bagging to be used in conjunction with the models DOTM, DSTM, OTM and STM (Fiorucci et al, 2016), which usually generates considerably more accurate results, whether point or interval forecasts. In this case, Box-Cox and Loess-based decomposition bootstrap (BLD-MBB) is used, for details see Bergmeir et al, 2016.
If num_bootstrap > 1, then the bagged series are extrapolated through simulation. In the end, point forecasts are calculated as the mean ($mean) or the median ($median) of these series, while interval forecasts are computed based on quantiles. To ensure a substantial number of simulations, each bagged series can be extrapolated multiple times through simulation, aiming for a total simulation volume of at least 10,000 series.
By default, the 90% significance seasonal Z-test, used by Assimakopoulos and Nikolopoulos (2000), is applied for quarterly and monthly time series. The possibility of first checking the unit root was included because it was pointed out that this test presents many flaws for time series with this characteristic (Fiorucci et al, 2016). In this case, the KPSS test is performed with a significance level of 5% and in the case of a unit root, then the series is differentiated before checking for seasonal behavior.
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>.
Bergmeir, C., Hyndman, R.J. and Benítez, J. M. (2016). Bagging exponential smoothing methods using STL decomposition and Box–Cox transformation. International journal of forecasting 32 (2), 303--312, <doi:10.1016/j.ijforecast.2015.07.002>.
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>.
forecTheta-package, dotm,
dstm, otm,
stm
#### additive seasonal decomposition ###
x = sin(2*pi*seq(0,9,len=300)) + exp((1:300)/150) + rnorm(mean=100,sd=0.5,n=300)
y = ts(x, frequency=33)
out <- bagged_dotm(y, h=50, s_type='additive', num_bootstrap = 5)
summary(out)
plot(out)
Run the code above in your browser using DataLab