SARIMA — Seasonal ARIMA
SARIMA extends ARIMA to handle seasonality — patterns that repeat over a fixed cycle (month, quarter). SARIMA adds seasonal AR/MA/differencing components alongside the non-seasonal ones.
When to use
Use SARIMA when the series has a clear seasonal cycle (e.g. monthly retail sales, quarterly tourism). ACF spikes at seasonal lags signal the need for SARIMA.
Model notation
- : the non-seasonal part (as in ARIMA).
- : the seasonal part with cycle (e.g. for monthly, for quarterly data).
Running in EcoLab
- Modeling module → Univariate time series family → SARIMA.
- Choose ; declare and the seasonal period (or auto).
- Run; view seasonal forecasts + diagnostics; export the replication code.
Replication code
- Stata
- R
- Python
* --- SARIMA(1,1,1)(1,1,1)_12 ---
tsset time
* Estimate SARIMA with seasonal component (s = 12)
arima y, arima(1,1,1) sarima(1,1,1,12)
* Residual diagnostics
predict resid, residuals
corrgram resid, lags(24)
* Forecast
tsappend, add(12)
predict yhat, dynamic(.)
# --- SARIMA ---
library(forecast)
# Create monthly time series
ts_data <- ts(df$y, start = c(2010, 1), frequency = 12)
# Fit SARIMA(1,1,1)(1,1,1)[12]
fit <- Arima(ts_data, order = c(1, 1, 1),
seasonal = c(1, 1, 1))
summary(fit)
# Diagnostics and forecast
checkresiduals(fit)
fc <- forecast(fit, h = 24)
plot(fc)
from statsmodels.tsa.statespace.sarimax import SARIMAX
import matplotlib.pyplot as plt
# Estimate SARIMA(1,1,1)(1,1,1,12)
model = SARIMAX(df['y'],
order=(1, 1, 1),
seasonal_order=(1, 1, 1, 12))
result = model.fit(disp=False)
print(result.summary())
# Diagnostics
result.plot_diagnostics(figsize=(10, 6))
plt.tight_layout(); plt.show()
# Forecast 24 months
forecast = result.get_forecast(steps=24)
print(forecast.summary_frame())
Limitations
- Many parameters ⇒ needs a long series spanning several seasonal cycles.
- Assumes the seasonal pattern is stable over time.