Theta Methods
AnoFox implements 6 Theta variants -- from the classic Theta method to DynamicOptimizedTheta and ThetaX with exogenous variable support. The Theta method gained prominence by winning the M3 forecasting competition, demonstrating that a simple decomposition approach can outperform complex statistical models on diverse datasets. In AnoFox, AutoTheta is the recommended production choice, while ThetaX extends the family with external predictor support via ts_forecast_exog_by.
The Theta method is a decomposition-based forecasting approach that separates a time series into two "theta lines" -- one capturing long-term trend and the other capturing short-term behavior -- then extrapolates and recombines them. It is known for winning the M3 forecasting competition.
| Model | Description |
|---|---|
Theta | Classic Theta method |
AutoTheta | Automatic Theta with optimized parameters |
OptimizedTheta | Theta with optimized decomposition parameters |
DynamicTheta | Theta with time-varying parameters |
DynamicOptimizedTheta | Dynamic + optimized Theta |
ThetaX | Theta with exogenous variables |
Theta
Classic Theta method that decomposes series into two theta lines and extrapolates.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal_period | INTEGER | auto | Seasonal period |
Example
SELECT * FROM ts_forecast_by(
'sales_data', NULL, date, sales,
'Theta', 14, '1d',
MAP{}
);
Best for: Short-term forecasts, simple + fast, competition-winning accuracy.
AutoTheta
Automatic Theta method with optimized parameters.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal_period | INTEGER | auto | Seasonal period |
Example
SELECT * FROM ts_forecast_by(
'sales_data', NULL, date, sales,
'AutoTheta', 14, '1d',
MAP{}
);
Best for: Short-term forecasts with automatic optimization.
OptimizedTheta
Theta method with optimized decomposition parameters.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal_period | INTEGER | auto | Seasonal period |
Example
SELECT * FROM ts_forecast_by(
'sales_data', NULL, date, sales,
'OptimizedTheta', 14, '1d',
MAP{}
);
Best for: Better accuracy than basic Theta through parameter optimization.
DynamicTheta
Theta method with time-varying parameters.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal_period | INTEGER | auto | Seasonal period |
Example
SELECT * FROM ts_forecast_by(
'changing_data', NULL, date, value,
'DynamicTheta', 28, '1d',
MAP{}
);
Best for: Series with changing patterns over time.
DynamicOptimizedTheta
Combines dynamic and optimized Theta approaches.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal_period | INTEGER | auto | Seasonal period |
Example
SELECT * FROM ts_forecast_by(
'complex_data', NULL, date, value,
'DynamicOptimizedTheta', 28, '1d',
MAP{}
);
Best for: Maximum Theta accuracy with dynamic adaptation.
Comparison
| Model | Speed | Optimization | Best Use Case |
|---|---|---|---|
| Theta | Fast | None | Quick baseline |
| AutoTheta | Fast | Automatic | General purpose |
| OptimizedTheta | Fast | Parameters | Better accuracy |
| DynamicTheta | Medium | Time-varying | Changing patterns |
| DynamicOptimizedTheta | Medium | Both | Maximum accuracy |
When to Use Theta Methods
| Scenario | Recommended |
|---|---|
| Quick forecast needed | Theta |
| Production system | AutoTheta |
| Maximum accuracy | DynamicOptimizedTheta |
| Changing patterns | DynamicTheta |
| Limited data | Theta |
| External predictors | ThetaX |
ThetaX
Theta method with exogenous (external) variables. Combines Theta's simplicity with external predictor support.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
seasonal_period | INTEGER | auto | Seasonal period |
Example
-- Create future exogenous values
CREATE TABLE future_exog AS
SELECT * FROM (VALUES
('2024-01-08'::DATE, 22.0),
('2024-01-09'::DATE, 20.0),
('2024-01-10'::DATE, 21.0)
) AS t(date, temperature);
-- Forecast with exogenous variables
SELECT * FROM ts_forecast_exog_by(
'sales_data', NULL, date, sales,
['temperature'],
'future_exog', date, ['temperature'],
'ThetaX', 3,
MAP{}, '1d'
);
Best for: Short-term forecasts with external drivers, simple models with predictor support.
The 5 Theta variants without exogenous support (Theta, AutoTheta, OptimizedTheta, DynamicTheta, DynamicOptimizedTheta) offer a speed-accuracy tradeoff: the basic Theta model is one of the fastest forecasters in the AnoFox library, while DynamicOptimizedTheta provides maximum accuracy at moderate computational cost. For series with limited historical data, the classic Theta method is particularly effective because it requires fewer observations to produce stable forecasts compared to ARIMA or TBATS.
See Exogenous Variables for detailed usage
Frequently Asked Questions
Why did Theta win the M3 competition if it is so simple?
The Theta method succeeds because it effectively decomposes a series into a dampened trend component and a short-term component, then recombines them. The classic Theta method is equivalent to simple exponential smoothing with drift. Its strength lies in this simplicity -- it avoids overfitting that plagues more complex models on short or noisy series.
What is the difference between OptimizedTheta and DynamicTheta?
OptimizedTheta optimizes the decomposition parameters (theta coefficient) to minimize forecast error but keeps parameters fixed over time. DynamicTheta allows parameters to vary over time to adapt to changing patterns. DynamicOptimizedTheta combines both approaches for maximum accuracy at moderate computational cost.
How much data does Theta need compared to ARIMA?
Theta requires less historical data than ARIMA. The basic Theta method can produce stable forecasts with as few as 10-15 observations, whereas ARIMA typically needs at least 30-50 (more for seasonal variants). This makes Theta an excellent choice for new products or short time series.