statsmodels.tsa.forecasting.theta.ThetaModel¶
- class statsmodels.tsa.forecasting.theta.ThetaModel(endog, *, period=None, deseasonalize=True, use_test=True, method='auto', difference=False)[source]¶
The Theta forecasting model of Assimakopoulos and Nikolopoulos (2000)
- Parameters:
- endogarray_like, 1d
The data to forecast.
- period
int
,default
None
The period of the data that is used in the seasonality test and adjustment. If None then the period is determined from y’s index, if available.
- deseasonalizebool,
default
True
A flag indicating whether the deseasonalize the data. If True and use_test is True, the data is only deseasonalized if the null of no seasonal component is rejected.
- use_testbool,
default
True
A flag indicating whether test the period-th autocorrelation. If this test rejects using a size of 10%, then decomposition is used. Set to False to skip the test.
- method{“auto”, “additive”, “multiplicative”},
default
“auto” The model used for the seasonal decomposition. “auto” uses a multiplicative if y is non-negative and all estimated seasonal components are positive. If either of these conditions is False, then it uses an additive decomposition.
- differencebool,
default
False
A flag indicating to difference the data before testing for seasonality.
See also
statsmodels.tsa.statespace.exponential_smoothing.ExponentialSmoothing
Exponential smoothing parameter estimation and forecasting
statsmodels.tsa.statespace.sarimax.SARIMAX
Seasonal ARIMA parameter estimation and forecasting
Notes
The Theta model forecasts the future as a weighted combination of two Theta lines. This class supports combinations of models with two thetas: 0 and a user-specified choice (default 2). The forecasts are then
\[\hat{X}_{T+h|T} = \frac{\theta-1}{\theta} b_0 \left[h - 1 + \frac{1}{\alpha} - \frac{(1-\alpha)^T}{\alpha} \right] + \tilde{X}_{T+h|T}\]where \(\tilde{X}_{T+h|T}\) is the SES forecast of the endogenous variable using the parameter \(\alpha\). \(b_0\) is the slope of a time trend line fitted to X using the terms 0, 1, …, T-1.
The model is estimated in steps:
Test for seasonality
Deseasonalize if seasonality detected
Estimate \(\alpha\) by fitting a SES model to the data and \(b_0\) by OLS.
Forecast the series
Reseasonalize if the data was deseasonalized.
The seasonality test examines where the autocorrelation at the seasonal period is different from zero. The seasonality is then removed using a seasonal decomposition with a multiplicative trend. If the seasonality estimate is non-positive then an additive trend is used instead. The default deseasonalizing method can be changed using the options.
References
[1]Assimakopoulos, V., & Nikolopoulos, K. (2000). The theta model: a decomposition approach to forecasting. International Journal of Forecasting, 16(4), 521-530.
[2]Hyndman, R. J., & Billah, B. (2003). Unmasking the Theta method. International Journal of Forecasting, 19(2), 287-290.
[3]Fioruci, J. A., Pellegrini, T. R., Louzada, F., & Petropoulos, F. (2015). The optimized theta method. arXiv preprint arXiv:1503.03529.
- Attributes:
deseasonalize
Whether to deseasonalize the data
difference
Whether the data is differenced in the seasonality test
method
The method used to deseasonalize the data
period
The period of the seasonality
use_test
Whether to test the data for seasonality
Methods
fit
([use_mle, disp])Estimate model parameters.
Properties
Whether to deseasonalize the data
Whether the data is differenced in the seasonality test
The method used to deseasonalize the data
The period of the seasonality
Whether to test the data for seasonality