Statistical Models (ARIMA, ETS, SARIMAX, ARAR)
When to Use
Use statistical models when:
- The series is short (< 200 observations)
- Interpretability is important (ARIMA coefficients, ETS components)
- You need built-in prediction intervals without residual bootstrapping
- As a baseline to compare against ML models
Related skills
- Prerequisite:
autocorrelation-and-lag-selection(read ACF/PACF to identify ARIMA ordersp,d,qbefore fitting) - Alongside:
baseline-forecasting(the other benchmark family: naive equivalent-date baselines) - Next:
prediction-intervals(ForecasterStatsprovides built-in parametric intervals via theinterval_methodargument) - Next:
hyperparameter-optimization(tune ARIMAorder/seasonal_ordervia grid search)
Stop Conditions
Scan before writing code. Each row lists a rule, the symptom when it is broken, and the recovery. Full pitfall catalog: the troubleshooting-common-errors skill.
| Rule | Symptom | Recovery |
|---|---|---|
Backtest and tune with backtesting_stats and grid_search_stats, not the ML variants |
backtesting_forecaster / grid_search_forecaster raises on ForecasterStats |
Call backtesting_stats / grid_search_stats |
Arima takes a 3-tuple seasonal_order=(P, D, Q) plus m; Sarimax takes a 4-tuple (P, D, Q, m) |
Wrong model order or TypeError |
Use Arima(order=(p,d,q), seasonal_order=(P,D,Q), m=12) |
Ets uses model='AAA' + m, not error= / trend= / seasonal= |
Deprecated-argument error | Use Ets(model='AAA', m=12) (A/M/N/Z per position) |
Seasonal models require m |
Seasonality silently ignored | Pass m=<seasonal period> to Arima / Ets |
Available Models
| Model | Class | Description |
|---|---|---|
| ARIMA | Arima |
AutoRegressive Integrated Moving Average |
| Auto-ARIMA | Arima(order=None) |
Automatic order selection |
| SARIMAX | Sarimax |
ARIMA with exogenous variables (seasonal) |
| ETS | Ets |
Exponential Smoothing (Error-Trend-Seasonal) |
| ARAR | Arar |
Autoregressive model with memory shortening |
Complete Workflow: ARIMA
import pandas as pd
from skforecast.recursive import ForecasterStats
from skforecast.stats import Arima
from skforecast.model_selection import backtesting_stats, TimeSeriesFold
# 1. Load data
data = pd.read_csv('data.csv', index_col='date', parse_dates=True)
data = data.asfreq('MS') # Monthly Start frequency
# 2. Manual ARIMA: specify order and seasonal_order
arima_model = Arima(
order=(1, 1, 1), # (p, d, q)
seasonal_order=(1, 1, 1), # (P, D, Q)
m=12, # Seasonal period
)
forecaster = ForecasterStats(estimator=arima_model)
forecaster.fit(y=data['target'])
predictions = forecaster.predict(steps=12)
# 3. Prediction intervals (all stat models support this natively,
# no bootstrapping needed). Accepts both `interval` and `alpha`.
predictions_interval = forecaster.predict_interval(
steps=12,
interval=[0.1, 0.9], # quantiles (0-1). Or use alpha=0.2 for 80% interval
)
Auto-ARIMA (Automatic Order Selection)
# Set order=None and seasonal_order=None to enable automatic order selection
auto_arima = Arima(order=None, seasonal_order=None, m=12)
forecaster = ForecasterStats(estimator=auto_arima)
forecaster.fit(y=data['target'])
# Check selected order
print(forecaster.estimator.best_params_['order'])
print(forecaster.estimator.best_params_['seasonal_order'])
predictions = forecaster.predict(steps=12)
ETS (Exponential Smoothing)
from skforecast.stats import Ets
# Model string: 1st=Error, 2nd=Trend, 3rd=Seasonal
# A=Additive, M=Multiplicative, N=None, Z=Auto-select
ets_model = Ets(model='AAA', m=12)
forecaster = ForecasterStats(estimator=ets_model)
forecaster.fit(y=data['target'])
predictions = forecaster.predict(steps=12)
Auto-ETS (Automatic Model Selection)
# Use model='ZZZ' (or model=None) to let ETS automatically select
# the best Error, Trend, and Seasonal components
auto_ets = Ets(model='ZZZ', m=12)
forecaster = ForecasterStats(estimator=auto_ets)
forecaster.fit(y=data['target'])
# Check the selected model configuration
print(forecaster.estimator.best_params_)
predictions = forecaster.predict(steps=12)
SARIMAX (with Exogenous Variables)
from skforecast.stats import Sarimax
sarimax_model = Sarimax(
order=(1, 1, 1),
seasonal_order=(1, 1, 1, 12), # (P, D, Q, seasonal_period)
)
forecaster = ForecasterStats(estimator=sarimax_model)
forecaster.fit(y=data['target'], exog=exog_train)
# For prediction, exog must cover the forecast horizon
predictions = forecaster.predict(steps=12, exog=exog_test)
ARAR
from skforecast.stats import Arar
arar_model = Arar()
forecaster = ForecasterStats(estimator=arar_model)
forecaster.fit(y=data['target'])
predictions = forecaster.predict(steps=12)
Backtesting Statistical Models
cv = TimeSeriesFold(
steps=12,
initial_train_size=len(data) - 60,
refit=False,
)
metric, predictions_bt = backtesting_stats(
forecaster=forecaster,
y=data['target'],
cv=cv,
metric='mean_absolute_error',
freeze_params=True, # Params from first fit reused in refits (avoids re-running auto selection)
)
# If freeze_params=False, auto selection runs independently each fold and output
# includes an extra 'estimator_params' column with the parameters selected per fold.
Multiple Models Simultaneously
# ForecasterStats accepts a list of models — fits each independently
from skforecast.stats import Arima, Ets
models = [
Arima(order=(1, 1, 1), seasonal_order=(1, 1, 1), m=12),
Ets(model='AAA', m=12),
]
forecaster = ForecasterStats(estimator=models)
forecaster.fit(y=data['target'])
# predict returns DataFrame with one column per model
predictions = forecaster.predict(steps=12)
Common Mistakes
- Using deprecated
Ets(error=, trend=, seasonal=)syntax: UseEts(model='AAA', m=12)with a model string instead. - Forgetting
mparameter: ARIMA and ETS seasonal models requirem(seasonal period). - Not using
backtesting_stats: Usebacktesting_stats()for statistical models, NOTbacktesting_forecaster(). - Using grid_search_forecaster for stats: Use
grid_search_stats()orrandom_search_stats()instead. - Passing
seasonal_order=(1,1,1,12)toArima:Arimauses a 3-tupleseasonal_order=(P,D,Q)plus a separatem=12parameter. The 4-tuple(P,D,Q,s)format is only forSarimax.
References
See references/model-parameters.md for complete constructor signatures of all statistical models (Arima, Sarimax, Ets, Arar), the Ets model string format, Auto-ARIMA parameters, seasonal_order differences between Arima and Sarimax, and grid search param_grid examples.