Time Series
Advanced 17 min read Time Series

ARIMA Models

The classic workhorse of statistical forecasting

ARIMA models a series as autoregression plus lagged errors, made stationary by differencing. Knowing how order choices (p, d, q), ACF/PACF heuristics and fitted diagnostics work turns a black-box forecast into a defensible one.

ARIMAautoregressivemoving averagedifferencingACFPACFstationary
Before we start

What you will learn

  • Explain p, d, q — autoregression, differencing, moving-average-error terms
  • Choose orders from ACF/PACF and fit diagnostics
  • Forecast with residuals-checked intervals
Introduction

What is this?

ARIMA (Autoregressive Integrated Moving Average) models a stationary series as a linear combination of its own lagged values (AR), lagged forecast errors (MA), after applying d differences to render it stationary. Selecting (p, d, q) is part art and part diagnostics: ACF/PACF tails suggest which lags matter, information criteria (AIC/BIC) rank candidate orders, and residual autocorrelation tests confirm the model extracted the signal. ARIMA shines on medium-horizon, moderately-stable series and is the benchmark every ML forecast must beat.

Motivation

Why do you need it?

  • It's the statistical gold standard: it produces point forecasts AND proper prediction intervals.
  • Its assumptions are explicit — you can defend an ARIMA to a statistician or an auditor.
  • Properly specified, it often beats fancy models on smooth, stationary-enough data.
  • Knowledge of ARIMA transfers to ETS, SARIMA and the family tree.
Think about it

Mental model

Imagine

A musician born-back a tune that repeats with feedback

Think of

ARMA structure

Autoregression says the next note is partly a weighted sum of previous notes; the moving-average term models the 'echoes' of recent mistakes. Differencing is like turning the recording so you play the changes, not the absolute level.

Mechanics

How it works

  • d = number of differences to stationarity: y_t' = y_t − y_{t-1} (repeat until ADF tests stationary).
  • p = AR order: y_t' depends on y_{t-1}', ..., y_{t-p}' with coefficients φ.
  • q = MA order: y_t' depends on recent white-noise errors ε_{t-1}..ε_{t-q} with coefficients θ.
  • Choose orders: decay with lags in ACF and p significant spikes in PACF → AR(p); q similarly for MA.
  • After fitting (MLE, Box-Jenkins), verify residuals are white noise (no ACF) and compute forecasts ± intervals.

ARIMA order selection from autocorrelation shapes.

Series
Difference
ACF/PACF
Fit
Diagnose
Real world

In production

  • A utility's mid-term (3-month) load forecast uses ARIMA(2,1,2) because the flat weekly structure favors parsimony over ML.
  • A crypto volume forecaster picks order via AIC scan nightly, refitting fast on rolling windows.
  • A marketing team uses ARIMA's prediction intervals to size campaign response budgets instead of point estimates.
Guidelines

Best practices

  • Seek the simplest (smallest AIC/BIC) order whose residuals pass white-noise tests.
  • Always difference with d from the ADF result, not 'let's try d=1'.
  • Prefer SARIMA when any regular seasonality lurks — plain ARIMA will leak it into residuals.
  • Verify out-of-sample backtest, not just in-sample fit, before trusting the order pick.
Watch out

Common mistakes

  • Fitting ARIMA to a trending series without differencing and reading spurious significance.
  • Selecting order by 'biggest p/q for best AIC' — model complexity races residual noise.
  • Ignoring residual autocorrelation after fit; 'the AIC was low' alone doesn't validate.
  • Forecasting beyond the regime the series came from (COVID-style breaks) with an order fitted on the old world.
Root cause analysis

Common issues

Error
Optimization failed to converge
Root cause

Explosive roots or wild scale in the series

Fix

Difference properly, standardize scale, and fix the initial values (method param).

Error
Forecast intervals implausibly wide
Root cause

Non-stationarity left in the fit or MA terms near the unit boundary

Fix

Redo differencing, cap (p,q) to reasonable orders, and verify the AR/MA characteristic roots are inside the unit circle.

When things break

Debugging tips

  • Residuals with a big ACF spike at lag 12? You missed seasonality — add SARIMA terms.
  • Diagnostic p-values 'too beautiful' (0.99) on tiny samples — check the test isn't underpowered.
  • Convergence warnings → scale the series (log or multiply) before fitting.
  • Compare a grid of (p, q) in (0..4)² with AIC — cheap and catches obvious misses.
Interviews

Interview checkpoint

Practice

Hands-on lab

Fit ARIMA the Defensible Way
35 min · advanced
In progress
Objectives
  • Difference to stationarity and confirm with ADF
  • Scan small (p, q) grids and pick by AIC + residual checks
  • Produce a backtested forecast with intervals

Fit ARIMA the Defensible Way

35 min · advanced

0/4 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

If differencing once is needed for stationarity, the model letter is:

2

Residuals must pass white-noise tests for the ARIMA order to be trusted.

Go deeper

Official documentation