9 · SARIMA (seasonal)
Real series repeat — every December, every Monday morning. SARIMA bolts a second seasonal AR/I/MA layer (P,D,Q,m) onto ARIMA to capture cycles ARIMA alone can't.
SARIMA(p,d,q)(P,D,Q,m) adds a second, seasonal AR/I/MA block that operates at lag m (the season length): seasonal differencing D removes the repeating cycle, and seasonal AR/MA terms relate this period to the same period last cycle (e.g. this December to last December).
Without this:
Plain ARIMA treats every December as just 'eleven months after last December' — it can't model the yearly cycle directly, so seasonal spikes leak into the residuals and forecasts miss every peak.
ARIMA models adjacent dependence — today on yesterday. But many series also depend on the same point one season ago: this December looks like last December, this Monday like last Monday. ARIMA can't express that directly. SARIMA does, by adding a second AR/I/MA block that operates at the seasonal lag m.
The notation is SARIMA(p, d, q)(P, D, Q, m):
- the lowercase
(p, d, q)is the ordinary (non-seasonal) ARIMA part from the last lesson; - the uppercase
(P, D, Q)is the seasonal AR/I/MA, but operating at multiples of the period; mis the season length: 12 for monthly-yearly, 7 for daily-weekly, 24 for hourly-daily.
The two pieces that matter most:
- Seasonal differencing
Dsubtracts the value from one full season ago:y_t − y_{t-m}. This removes the repeating cycle the same way ordinary differencingdremoves a trend. - Seasonal AR
P/ MAQrelate this period's value (or error) to the value (or error) one, two, … seasons back.(P=1)means "this December is partly explained by last December."
A good default for clearly seasonal monthly data is something like (1,1,1)(1,1,0,12). Keep all orders tiny — SARIMA is the slowest model in this track because the state space grows with m. Below we generate a short seasonal series (96 monthly points, period 12), hold out the final season, fit a small SARIMAX, and forecast one season ahead — printing and plotting forecast vs hold-out.
Python (in browser)
A short monthly seasonal series, fit with a small SARIMAX(1,1,1)(1,1,0,12) and forecast one season (12 months) ahead. The seasonal differencing + AR term recover the yearly cycle; the plot overlays forecast, actual hold-out, and a confidence band.
Python runs entirely in your browser via Pyodide (~6 MB on first Run, cached after).
What does the m in a SARIMA(p,d,q)(P,D,Q,m) model specify?
- SARIMA(p,d,q)(P,D,Q,m) = ordinary ARIMA + a seasonal AR/I/MA block operating at the season lag m.
- Seasonal differencing D (y_t − y_{t-m}) removes the repeating cycle; seasonal AR/MA link this period to the same period in past cycles.
- Set m from the calendar (12 monthly, 7 weekly, 24 hourly) and keep all orders tiny — SARIMA is the slowest fit, so use short data and small orders.
SARIMA is the go-to classical model for seasonal demand, energy load, and retail sales; SARIMAX adds exogenous regressors (price, promotions, weather) on top.
If you remove it: Without a seasonal model your forecasts flatten out every recurring peak and trough, badly missing the calendar effects that dominate real business series.