baggedThetaModels: Bagged Theta Models

Bagged Theta ModelsR Documentation

Bagged Theta Models

Description

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).

Usage

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", xreg=NULL)

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", xreg=NULL)

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", xreg=NULL)

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", xreg=NULL)

Arguments

y

Object of time series class.

h

Number of required forecasting periods.

level

Levels for prediction intervals.

num_bootstrap

Number of bootstrap samples to be considered in the forecast (num argument of the forecast::bld.mbb.bootstrap function).

bs_bootstrap

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.

s_type

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).

s_test

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.

lambda

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.

par_ini

Vector of initialization for (ell, alpha, theta) parameters.

estimation

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.

lower

The lower limit of parametric space.

upper

The upper limit of parametric space.

opt.method

The numeric optimisation method for optim() function. Choose one among 'Nelder-Mead', 'L-BFGS-B', 'SANN'.

xreg

A matrix with the regressor variables including the out-of-sample data.

Details

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.

Value

An object of thetaModel class with one list containing the elements:

$method

The name of the model/method

$y

The original time series.

$s

A binary indication for seasonal decomposition (original time series).

type

Seasonal decomposition type (original time series).

opt.method

The optimisation method used in the optim() function.

$par

The estimated values of (ell, alpha, theta) parameters (original time series)

$weights

The estimated weights values (original time series).

$fitted

A time series element with the fitted points (original time series).

$residuals

A time series element with the residual points (original time series).

$mean

The forecasting values calculed as the mean of bootstrapping simulations.

$median

The forecasting values calculed as the median of bootstrapping simulations.

$level

The levels for prediction intervals.

$lower

Lower limits for prediction intervals.

$upper

Upper limits for prediction intervals.

Author(s)

Jose Augusto Fiorucci, Francisco Louzada, Igor De Oliveira Barros Faluhelyi.

References

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>.

See Also

forecTheta-package, dotm, dstm, otm, stm

Examples



#### 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)



forecTheta documentation built on June 8, 2025, 10:02 a.m.