Skip to content

MSARIMA

Ivan Svetunkov edited this page Jan 30, 2026 · 8 revisions

MSARIMA - Multiple Seasonal ARIMA

MSARIMA (Multiple Seasonal ARIMA) is an optimized implementation of ARIMA for handling multiple seasonal patterns. It is a wrapper of ADAM that skips zero polynomials, making it substantially faster and more accurate than SSARIMA for high-frequency data.

Note: Not yet implemented in Python.

Overview

MSARIMA efficiently handles complex seasonal structures like:

  • Hourly data with daily (24) and weekly (168) patterns
  • Daily data with weekly (7) and annual (365) patterns
  • Sub-daily data with multiple intraday and interday cycles

The implementation differs from SSARIMA by directly mapping non-zero components, reducing the state dimension and improving computational efficiency.

Read more about ADAM ARIMA (and thus MSARIMA) in Svetunkov (2023), Chapter 9.

R Usage

library(smooth)

# Basic non-seasonal ARIMA(1,1,1)
msarima(y, orders=c(1,1,1), lags=1)

# SARIMA(1,1,1)(0,1,1)[12]
msarima(y, orders=list(ar=c(1,0), i=c(1,1), ma=c(1,1)), lags=c(1,12))

# Complex multiple seasonality
# SARIMA(1,1,1)(0,1,1)[24](2,0,1)[168](0,0,1)[720]
msarima(y,
    orders=list(ar=c(1,0,2,0), i=c(1,1,0,0), ma=c(1,1,1,1)),
    lags=c(1,24,168,720)
)

# With holdout validation
msarima(y, orders=list(ar=c(1,1), i=c(1,1), ma=c(1,1)),
        lags=c(1,24), h=48, holdout=TRUE)

Automatic Order Selection

auto.msarima() is a wrapper of auto.adam().

# Automatic selection
auto.msarima(y, h=24, holdout=TRUE)

# With maximum orders
auto.msarima(y, orders=list(ar=c(2,1), i=c(1,1), ma=c(2,1)), lags=c(1,24))

# Check constant necessity
auto.msarima(y, constant=NULL)

Parameters

Parameter Type (R) Default Description
y vector/ts - Time series data
orders list/vector - ARIMA orders per lag
lags numeric vector - Seasonal lags
constant logical/numeric FALSE Include constant/drift
arma list/vector NULL Fixed AR/MA parameters
model adam NULL Previously estimated model
initial character "backcasting" Initialization method
bounds character "admissible" Parameter bounds
h integer 0 Forecast horizon
holdout logical FALSE Use holdout validation
xreg matrix NULL External regressors
regressors character "use" How to handle regressors

Orders Specification

Each element in ar, i, ma vectors corresponds to the lag at the same position:

# SARIMA(1,1,1)(1,0,1)[12](0,1,1)[52]
orders = list(
    ar = c(1, 1, 0),   # AR(1) at lag 1, AR(1) at lag 12, AR(0) at lag 52
    i  = c(1, 0, 1),   # I(1) at lag 1, I(0) at lag 12, I(1) at lag 52
    ma = c(1, 1, 1)    # MA(1) at all lags
)
lags = c(1, 12, 52)

Initialization Methods

  • "backcasting": Recommended for high-frequency data
  • "optimal": Optimize initial states
  • "two-stage": Backcast then optimize
  • "complete": Full backcasting including regressors

Use "backcasting" for speed. Use the others if you have a lot of free time and have nothing else better to do.

More detailed explanation of those is provided in Section 11.4 of Svetunkov (2023).

With External Regressors

# MSARIMAX model
msarima(y, orders=list(ar=c(1,0), i=c(1,1), ma=c(1,1)),
        lags=c(1,24), xreg=X)

# Adaptive regressors
msarima(y, orders=list(ar=c(1,0), i=c(1,1), ma=c(1,1)),
        lags=c(1,24), xreg=X, regressors="adapt")

Output

Returns an object of class "adam" containing:

Element Type (R) Description
model character Model name
arma list AR/MA parameters
orders list Order specification
constant numeric Constant value
states matrix State matrix
transition matrix Transition matrix F
persistence vector Persistence vector
measurement vector Measurement vector
fitted vector Fitted values
forecast vector Point forecasts
residuals vector Model residuals
lower vector Lower prediction interval bound
upper vector Upper prediction interval bound
logLik numeric Log-likelihood value
lags vector Lags used in the model

MSARIMA vs SSARIMA

Feature MSARIMA SSARIMA
Speed Fast Slow
Memory usage Low High
Multiple seasonality Optimized Full polynomial expansion
High-frequency data Recommended Can be slow

Use MSARIMA (or ADAM) for:

  • Hourly, sub-hourly data
  • Multiple seasonal patterns
  • Large datasets

References

See Also

Related Functions

  • ADAM - Unified framework (Python/R)
  • SSARIMA - Original State Space ARIMA
  • ES - Exponential Smoothing

Parameter Documentation

Clone this wiki locally