Skip to main content

ARIMA Models

AutoRegressive Integrated Moving Average - models dependencies between observations.

ModelDescription
ARIMAClassic ARIMA with manual parameter specification
AutoARIMAAutomatic ARIMA with (p,d,q) selection
ARIMAXARIMA with exogenous variables
Showing 3 of 3

ARIMA

Classic ARIMA model with manual parameter specification.

Parameters

ParameterTypeRequiredDescription
pINTEGERYesAR (autoregressive) order
dINTEGERYesDifferencing order
qINTEGERYesMA (moving average) order
seasonal_periodINTEGERNoFor seasonal ARIMA
PINTEGERNoSeasonal AR order
DINTEGERNoSeasonal differencing
QINTEGERNoSeasonal MA order

Example

-- Non-seasonal ARIMA(1,1,1)
SELECT * FROM anofox_fcst_ts_forecast(
'sales_data',
'date',
'sales',
'ARIMA',
28,
MAP{'p': '1', 'd': '1', 'q': '1'}
);

-- Seasonal ARIMA(1,1,1)(1,1,1)[7]
SELECT * FROM anofox_fcst_ts_forecast(
'weekly_data',
'date',
'value',
'ARIMA',
28,
MAP{'p': '1', 'd': '1', 'q': '1', 'P': '1', 'D': '1', 'Q': '1', 'seasonal_period': '7'}
);

Best for: Complex patterns when you know the appropriate order.


AutoARIMA

Automatic ARIMA with (p,d,q) parameter selection using information criteria.

Parameters

ParameterTypeDefaultDescription
seasonal_periodINTEGERautoSeasonal period
max_pINTEGER5Maximum AR order
max_dINTEGER2Maximum differencing order
max_qINTEGER5Maximum MA order

Example

SELECT * FROM anofox_fcst_ts_forecast(
'sales_data',
'date',
'sales',
'AutoARIMA',
28,
MAP{'seasonal_period': '7'}
);

Best for: Complex patterns, long-term forecasts, automatic tuning.


Parameter Selection Guide

Scenariopdq
Stationary data1-201-2
Trending data1-211-2
Strong trend1-221-2
Random walk010

When to Use ARIMA vs AutoARIMA

ScenarioRecommended
Known order from domain expertiseARIMA
Exploratory analysisAutoARIMA
Production pipelineAutoARIMA
Performance-criticalARIMA (faster)
Many time seriesAutoARIMA
External predictorsARIMAX

ARIMAX

ARIMA with exogenous (external) variables. Incorporates external predictors like temperature, promotions, or economic indicators.

Parameters

ParameterTypeDefaultDescription
seasonal_periodINTEGERautoSeasonal period
max_pINTEGER5Maximum AR order
max_dINTEGER2Maximum differencing order
max_qINTEGER5Maximum MA order

Example

-- Create future exogenous values
CREATE TABLE future_exog AS
SELECT * FROM (VALUES
('2024-01-08'::DATE, 22.0, 1),
('2024-01-09'::DATE, 20.0, 0),
('2024-01-10'::DATE, 21.0, 1)
) AS t(date, temperature, promotion);

-- Forecast with exogenous variables
SELECT * FROM ts_forecast_exog(
'sales_data', date, sales,
'temperature,promotion',
'future_exog',
'ARIMAX', 3, MAP{}
);

Best for: Complex patterns with external drivers, weather-adjusted demand, promotion planning.

See Exogenous Variables for detailed usage

🍪 Cookie Settings