Theta Methods
Decomposition-based forecasting. 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.
See Exogenous Variables for detailed usage