-
Notifications
You must be signed in to change notification settings - Fork 22
SSARIMA
SSARIMA (State Space ARIMA) implements ARIMA models using the Single Source of Error (SSOE) state-space framework. This allows for consistent treatment with other smooth package models and proper handling of prediction intervals.
R-only. SSARIMA is not yet ported to Python — see Roadmap. Use MSARIMA in Python for a faster, more general ARIMA implementation.
ssarima(y, orders = list(ar = c(0), i = c(1), ma = c(1)),
lags = c(1, frequency(y)),
constant = FALSE, arma = NULL, model = NULL,
initial = c("backcasting", "optimal", "two-stage", "complete"),
loss = c("likelihood", "MSE", "MAE", "HAM",
"MSEh", "TMSE", "GTMSE", "MSCE", "GPL"),
h = 0, holdout = FALSE,
bounds = c("admissible", "usual", "none"),
silent = TRUE,
xreg = NULL, regressors = c("use", "select", "adapt"),
initialX = NULL, ...)The function constructs ARIMA(p,d,q) models and their seasonal extensions SARIMA(p,d,q)(P,D,Q)[m] in state-space form, enabling:
- Direct order selection without statistical test
- Combination with ETS components via ADAM
- Consistent prediction interval methodology
- External regressors with adaptive coefficients
The formulation was first introduced by Hyndman et al. (2008) and extended in Svetunkov (2023); see References.
library(smooth)
# Basic ARIMA(1,1,1)
ssarima(y, orders=c(ar=1, i=1, ma=1), lags=1)
# Using vector notation for non-seasonal ARIMA
ssarima(y, orders=c(1,1,1))
# SARIMA(1,1,1)(1,1,1)[12]
ssarima(y, orders=list(ar=c(1,1), i=c(1,1), ma=c(1,1)), lags=c(1,12))
# SARIMA(2,0,0)(1,0,0)[4]
ssarima(y, orders=list(ar=c(2,1)), lags=c(1,4))
# With holdout validation
ssarima(y, orders=list(ar=1, i=1, ma=c(1,1)), lags=c(1,4), h=18, holdout=TRUE)
# Reuse a previous model on new data
model1 <- ssarima(y1, orders=list(ar=1, i=1, ma=1))
ssarima(y2, model=model1)# Automatic ARIMA order selection
auto.ssarima(y, h=12, holdout=TRUE)
# With maximum orders specified
auto.ssarima(y, orders=list(ar=c(3,2), i=c(2,1), ma=c(3,2)), lags=c(1,12))
# More exhaustive search (slow)
auto.ssarima(y, h=12, holdout=TRUE, fast=FALSE)R-only. SSARIMA is not yet ported to Python — see Roadmap. All parameters below are R-side only.
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
vector/ts | — | Time series data. |
orders |
list/vector | list(ar=0, i=1, ma=1) |
ARIMA orders. |
lags |
numeric vector | c(1, frequency(y)) |
Lags for each order. |
constant |
logical/numeric | FALSE |
Include constant/drift. |
arma |
list/vector | NULL |
Fixed AR/MA parameters. |
initial |
character | "backcasting" |
Initialisation method. |
loss |
character | "likelihood" |
Loss function. |
h |
integer | 0 |
Forecast horizon. |
holdout |
logical | FALSE |
Use holdout validation. |
bounds |
character | "admissible" |
Parameter bounds. |
xreg |
matrix | NULL |
External regressors. |
regressors |
character | "use" |
How to handle regressors. |
Orders are specified as a list with ar, i, and ma components:
# SARIMA(1,1,1)(0,1,1)[12]
orders = list(ar=c(1,0),
i=c(1,1),
ma=c(1,1))
lags = c(1, 12)
# SARIMA(1,0,1)(1,0,1)[24](0,1,1)[168]
orders = list(ar=c(1,1,0),
i=c(0,0,1),
ma=c(1,1,1))
lags = c(1, 24, 168)-
"backcasting": Recommended for high-frequency data -
"optimal": Optimize all initial states -
"two-stage": Backcast then optimize -
"complete": Full backcasting including regressors
-
"admissible": Guarantee model stability -
"usual": AR/MA parameters between -1 and 1 -
"none": No restrictions (use with caution)
# ARIMAX model
ssarima(y, orders=list(ar=1, i=1, ma=1), xreg=X)
# Automatic regressor selection
ssarima(y, orders=list(ar=1, i=1, ma=1), xreg=X, regressors="select")
# Adaptive regressors
ssarima(y, orders=list(ar=1, i=1, ma=1), xreg=X, regressors="adapt")Returns an object of class "adam" containing (R only):
| Element | Type (R) | Description |
|---|---|---|
model |
character | Model name (e.g., "ARIMA(1,1,1)") |
arma |
list | List of AR/MA parameters |
orders |
list | Order specification |
constant |
numeric | Constant/drift value |
states |
matrix | State matrix |
persistence |
vector | Persistence vector |
transition |
matrix | Transition matrix F |
measurement |
vector | Measurement vector w |
fitted |
vector | Fitted values |
forecast |
vector | Point forecasts |
residuals |
vector | Model residuals |
logLik |
numeric | Log-likelihood value |
lags |
vector | Lags used in the model |
For multiple seasonal frequencies, MSARIMA is more computationally efficient than SSARIMA. Consider using MSARIMA or ADAM directly for complex seasonal structures.
- Svetunkov, I., & Boylan, J.E. (2019). State-space ARIMA for supply-chain forecasting. International Journal of Production Research, 58(3), 818-827. DOI: 10.1080/00207543.2019.1600764.
- Hyndman, R.J., Koehler, A.B., Ord, J.K., Snyder, R.D. (2008). Forecasting with Exponential Smoothing: The State Space Approach. Springer (Chapter 11 for the SSARIMA formulation). DOI: 10.1007/978-3-540-71918-2.
- Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). Online: https://openforecast.org/adam/.
- ARIMA background: Chapter 8.
- SSARIMA: Subsection 19.2.2.
- ADAM - Unified framework (recommended)
- MSARIMA - More efficient for multiple seasonalities
- ES - Exponential Smoothing
- Orders-and-Lags - ARIMA orders and lags specification
- Loss-Functions - Loss function options
- Explanatory-Variables - Using external regressors
- Initialisation - State initialization methods
- Bounds - Parameter restrictions