5 · ACF & PACF
The autocorrelation and partial-autocorrelation functions are the diagnostic plots that tell you which AR and MA orders to try — reading their spikes is a core skill.
ACF measures correlation at lag k including everything in between; PACF measures it after removing the intermediate lags. The PACF cutoff suggests the AR order p; the ACF cutoff suggests the MA order q.
Without this:
Without ACF/PACF you guess ARIMA orders blindly; reading the spike pattern turns model selection into an informed first guess instead of brute-force search.
Once a series is stationary, two diagnostic plots tell you how the past relates to the present and suggest which model orders to try.
-
ACF — autocorrelation function.
ACF(k)is the correlation between the series and itself shifted byksteps. Crucially, it includes all the indirect paths: if today depends on yesterday and yesterday on the day before, then today and the day-before-yesterday are correlated through yesterday — and the ACF at lag 2 picks that up. -
PACF — partial autocorrelation function.
PACF(k)is the correlation at lagkafter removing the contribution of all the shorter lags in between. It isolates the direct relationship betweeny_tandy_{t-k}, controlling fory_{t-1}, …, y_{t-k+1}.
The classic order-selection rules (Box-Jenkins):
- AR(p) — pure autoregressive: the PACF cuts off sharply after lag p (spikes through lag p, then drops into the noise band), while the ACF decays gradually.
- MA(q) — pure moving-average: the ACF cuts off after lag q, while the PACF decays gradually.
Anything outside the shaded confidence band (≈ ±2/√n) is a "significant" spike. For an AR(1) process y_t = φ·y_{t-1} + ε, the signature is unmistakable: the ACF decays geometrically (φ, φ², φ³, …) while the PACF has a single significant spike at lag 1 and nothing after — directly reading off p = 1. Below we simulate an AR(1) with φ ≈ 0.7, print the first lags as numbers with a text bar, and save the real plot_acf/plot_pacf figures.
Python (in browser)
ACF and PACF of an AR(1) (φ≈0.7): the ACF decays geometrically while the PACF has one spike at lag 1 — the textbook AR(1) signature that reads off p=1.
Python runs entirely in your browser via Pyodide (~6 MB on first Run, cached after).
On a stationary series, the ACF decays slowly while the PACF shows a single significant spike at lag 1 and nothing after. What does this suggest?
- ACF(k) is correlation at lag k including indirect paths; PACF(k) removes the intermediate lags to isolate the direct link.
- PACF cutoff → AR order p; ACF cutoff → MA order q (Box-Jenkins rules).
- An AR(1) shows a geometrically-decaying ACF and a single PACF spike at lag 1.
ACF/PACF plots are the first step of manual ARIMA order selection and a sanity check on residuals (they should look like white noise after a good fit).
If you remove it: Without reading ACF/PACF you brute-force every (p,q) combination blindly and can't tell whether a fitted model has left structure in the residuals.