-
Notifications
You must be signed in to change notification settings - Fork 22
Orders and Lags
This page documents the orders and lags parameters used for specifying ARIMA components and seasonal periods in smooth models. This applies to ADAM, SSARIMA, MSARIMA, and GUM models.
| Argument | Type | Default | Valid values | Applies to |
|---|---|---|---|---|
lags |
int or list/vector of ints | R: frequency(y). Python: None → no seasonality. |
Positive integers (e.g. 12, [24, 168], [1, 12]). |
All forecasting functions. |
orders |
R: named list list(ar=…, i=…, ma=…, select=…). Python: dict with the same keys. |
R: list(ar=0, i=0, ma=0, select=FALSE) (ADAM); see per-function defaults. Python: None. |
Each of ar/i/ma is a non-negative int or vector of non-negative ints (one per lag). select is bool. |
R: adam, auto.adam, msarima, ssarima, gum. Python: ADAM, AutoADAM, MSARIMA (and AutoMSARIMA). |
ar_order / i_order / ma_order
|
Python only; int or list of ints | 0 |
Same as the corresponding element inside orders. |
Python ADAM, AutoADAM, MSARIMA. |
arima_select |
Python only; bool | False |
Mirrors orders["select"] in R. |
Python ADAM, AutoADAM. |
Precedence in Python: if both orders and any of ar_order/i_order/ma_order are supplied, orders wins and the scalars are ignored with a UserWarning. See Glossary#arima-ar-ma-i-family for the disambiguation between the lookalike names.
The lags parameter defines seasonal periods and lags for the the state-space components.
# R: Monthly seasonality
model <- adam(y, model="AAA", lags=12)
# R: Multiple seasonality (hourly data with daily + weekly)
model <- adam(y, model="AAA", lags=c(24, 168))# Python: Monthly seasonality
model = ADAM(model="AAA", lags=12)
# Python: Multiple seasonality
model = ADAM(model="AAA", lags=[24, 168])Both ADAM and AutoADAM accept lags as either a scalar (lags=12) or a list (lags=[12]); the scalar form is normalised to a single-element list internally.
lags Value |
Interpretation | Example Data |
|---|---|---|
1 |
No seasonality | Non-seasonal data |
12 |
Month of year seasonality | Monthly data |
4 |
Quarter of year seasonality | Quarterly data |
7 |
Day of week seasonality | Daily data |
c(24, 168) |
Hour of day + hour of week | Hourly data |
c(7, 365) |
Day of week + day of year | Daily data |
c(1, 12) |
Non-seasonal + Monthly | For the seasonal ARIMA |
If not specified:
-
R: Uses
frequency(y)- the frequency attribute of the time series -
Python: Uses
None, which means no seasonality
When multiple lags are provided, ETS creates model with several seasonal components for each lag:
# ETS(A,A,A)[24,168] - two seasonal components
model <- adam(y, model="AAA", lags=c(24, 168))The model is printed as ETS(A,A,A)[24,168] indicating the lags used.
Similar behaviour is in Python:
# ETS(A,A,A)[24,168] - two seasonal components
model = ADAM(model="AAA", lags=[24, 168])Extracts the lags used in the model.
# Model with multiple seasonalities
model <- adam(y, "MAM", lags=c(1, 24, 168))
lags(model) # [1] 1 24 168
# ARIMA lags
model <- adam(BJsales, "NNN",
orders=list(ar=c(1,1), i=c(1,1), ma=c(1,1)),
lags=c(1,12))
lags(model) # [1] 1 12from smooth import ADAM
model = ADAM(model="MAM", lags=[1, 24, 168])
model.fit(y)
# Get model lags
model_lags = model.lags # [1, 24, 168]R: Returns a numeric vector of lags used in the model construction.
Python: Returns a List[int] of lags used in the model construction.
The orders parameter specifies ARIMA orders: autoregressive (AR), integration (I), and moving average (MA) components.
Python supports two equivalent syntaxes.
Preferred (scalar/list parameters):
# ARIMA(1,1,1)
model = ADAM(model="NNN", ar_order=1, i_order=1, ma_order=1)
model.fit(y)
# SARIMA(1,1,1)(1,1,1)[12]
model = ADAM(model="NNN",
ar_order=[1, 1], i_order=[1, 1], ma_order=[1, 1],
lags=[1, 12])
model.fit(y)
# ETS(A,A,N) + ARIMA(1,0,1)
model = ADAM(model="AAN", ar_order=1, i_order=0, ma_order=1)
model.fit(y)R-style dict (alternative):
# ARIMA(1,1,1)
model = ADAM(model="NNN", orders={"ar": 1, "i": 1, "ma": 1})
model.fit(y)
# SARIMA(1,1,1)(1,1,1)[12]
model = ADAM(model="NNN",
orders={"ar": [1, 1], "i": [1, 1], "ma": [1, 1]},
lags=[1, 12])
model.fit(y)
# With automatic order selection
model = ADAM(model="NNN",
orders={"ar": [3, 2], "i": [2, 1], "ma": [3, 2], "select": True},
lags=[1, 12])
model.fit(y)When orders is supplied, it takes precedence and the scalar ar_order / i_order / ma_order arguments are ignored (a UserWarning is emitted). Use orders for the full dict-style spec or use the three scalar arguments alone — never both. See ADAM § ARIMA Components and AutoADAM § ARIMA orders precedence for the full rule.
For non-seasonal ARIMA, orders can be a simple vector:
# R: ARIMA(1,1,1)
model <- adam(y, model="NNN", orders=c(1,1,1), lags=1)For seasonal ARIMA, use a list with ar, i, and ma components:
# R: SARIMA(1,1,1)(1,1,1)[12]
model <- adam(y, model="NNN",
orders=list(ar=c(1,1), i=c(1,1), ma=c(1,1)),
lags=c(1,12))Each element in the ar, i, ma vectors corresponds to the lag at the same position in lags:
# SARIMA(1,1,1)(0,1,1)[12] - no seasonal AR
orders = list(
ar = c(1, 0), # AR(1) at lag 1, AR(0) at lag 12
i = c(1, 1), # I(1) at lag 1, I(1) at lag 12
ma = c(1, 1) # MA(1) at lag 1, MA(1) at lag 12
)
lags = c(1, 12)# SARIMA(1,1,1)(1,0,1)[24](0,1,1)[168]
orders = list(
ar = c(1, 1, 0), # AR at lags 1, 24, but not 168
i = c(1, 0, 1), # I at lags 1, 168, but not 24
ma = c(1, 1, 1) # MA at all lags
)
lags = c(1, 24, 168)In auto.adam() or when using orders=list(select=TRUE):
# Automatic ARIMA order selection
model <- adam(y, model="NNN",
orders=list(ar=c(3,2), i=c(2,1), ma=c(3,2), select=TRUE),
lags=c(1,12))The values in ar, i, ma become maximum orders to test when select=TRUE.
# ETS(A,A,N) + ARIMA(1,0,1)
model <- adam(y, model="AAN", orders=c(1,0,1), lags=1)
# ETS(M,M,M)[12] + SARIMA(1,0,1)[12]
model <- adam(y, model="MMM", orders=list(ar=1, ma=1), lags=12)Extracts the ARIMA orders from a fitted model.
# SARIMA model
model <- adam(BJsales, "NNN",
orders=list(ar=c(1,1), i=c(1,1), ma=c(1,1)),
lags=c(1,12))
orders(model)
# $ar
# [1] 1 1
#
# $i
# [1] 1 1
#
# $ma
# [1] 1 1from smooth import ADAM
model = ADAM(model="NNN", ar_order=1, i_order=1, ma_order=1)
model.fit(y)
# Get ARIMA orders
arima_orders = model.orders
# {'ar': [1], 'i': [1], 'ma': [1]}R: Returns a list with components:
-
ar- Autoregressive orders per lag -
i- Integration orders per lag -
ma- Moving average orders per lag
Python: Returns a Dict[str, List[int]] with keys 'ar', 'i', 'ma' containing the respective orders.
For pure ETS models, orders() returns zero orders.
| Function | Applies To | R | Python |
|---|---|---|---|
| ADAM | ETS, ARIMA, combined | Full orders list |
ar_order/i_order/ma_order (preferred) or orders dict |
| ES | ETS only | Only lags
|
Only lags
|
| MSARIMA | ARIMA | Full orders list |
orders dict |
| CES | CES | Only lags
|
Only lags
|
| SSARIMA | ARIMA | Full orders list |
— (R-only; see Roadmap) |
| GUM | GUM |
orders = states per lag |
— (R-only; see Roadmap) |
- Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). Chapter 8 and Chapter 9
- Hyndman, R.J., et al. (2008). Forecasting with Exponential Smoothing: The State Space Approach. Chapter 11.
- ADAM - Main ADAM function
- SSARIMA - State Space ARIMA
- MSARIMA - Multiple Seasonal ARIMA
- Model-Specification - ETS model specification