-
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.
Note: Not yet implemented in Python.
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
This is the formulation first introduced by Hyndman et al. (2008), Chapter 11. See details in Svetunkov (2023), Chapter 8 and in Subsection 19.2.2.
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)| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
y |
vector/ts | TBA | - | Time series data |
orders |
list/vector | TBA | list(ar=0,i=1,ma=1) | ARIMA orders |
lags |
numeric vector | TBA | c(1, frequency(y)) | Lags for each order |
constant |
logical/numeric | TBA | FALSE | Include constant/drift |
arma |
list/vector | TBA | NULL | Fixed AR/MA parameters |
initial |
character | TBA | "backcasting" | Initialization method |
loss |
character | TBA | "likelihood" | Loss function |
h |
integer | TBA | 0 | Forecast horizon |
holdout |
logical | TBA | FALSE | Use holdout validation |
bounds |
character | TBA | "admissible" | Parameter bounds |
xreg |
matrix | TBA | NULL | External regressors |
regressors |
character | TBA | "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 Berlin Heidelberg. DOI: 10.1007/978-3-540-71918-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