Lesson 1 - What ACF and PACF Measure
Welcome to What ACF and PACF Measure
Module 3 left off with a stationary series and a direct preview: Module 5’s ARIMA models need two numbers — how many autoregressive (AR) terms and how many moving-average (MA) terms — and this module is where those numbers come from. The tool is a pair of functions with confusingly similar names: the autocorrelation function (ACF) and the partial autocorrelation function (PACF). They look at the same data and often produce similar-looking plots, but they answer genuinely different questions, and the difference between their answers is what makes order selection possible at all.
By the end of this lesson, you will be able to:
- Define the ACF as the correlation between a series and its own lagged values
- Define the PACF as that same correlation with intermediate lags’ effects removed
- Explain, with a concrete example, why the two can disagree at the same lag
- Compute both on Cyclepath’s stationary series and read the first few values
Let’s define them precisely.
The Autocorrelation Function (ACF)
The ACF at lag k is simply the correlation between a series and itself, shifted by k steps — how related is y_t to y_{t-k}, across every pair of points that far apart in the series:
import numpy as np, pandas as pd
from statsmodels.tsa.stattools import acf, pacf
def cyclepath():
idx = pd.date_range("2016-01-01", periods=96, freq="MS")
t = np.arange(96); rng = np.random.default_rng(42)
trend = 9000 + 90*t; seasonal = 3200*np.sin(2*np.pi*(t-3)/12); noise = rng.normal(0,350,96)
return pd.Series(np.round(trend+seasonal+noise).astype(int), index=idx, name="trips")
y = cyclepath()
D1 = y.diff(12).dropna() # Module 3's stationary series
a = acf(D1, nlags=5)
print(np.round(a, 3)) # [1.0, -0.028, -0.078, -0.087, -0.131, 0.088]Lag 0 is always exactly 1.0 — every series correlates perfectly with itself. Lag 1 (-0.028) says: this month’s seasonally-differenced value has almost no linear relationship with last month’s. Lag 4 (-0.131) is a bit stronger, but still modest. Nothing dramatic yet in these first few lags — which itself is informative, and Lesson 4 will look at the full picture including a lag that is dramatic.
Crucially, the ACF at lag k doesn’t isolate a direct relationship — it includes any relationship that flows through the lags in between. If y_t relates strongly to y_{t-1}, and y_{t-1} relates strongly to y_{t-2}, the ACF at lag 2 will pick up some of that chained relationship even if y_t and y_{t-2} have no direct connection at all.
The Partial Autocorrelation Function (PACF)
The PACF at lag k asks a more surgical question: what’s left of the relationship between y_t and y_{t-k} after accounting for everything already explained by the lags in between (1, 2, ..., k-1)? It’s the same two points, y_t and y_{t-k}, but with the indirect, chained-through relationship subtracted out first.
p = pacf(D1, nlags=5)
print(np.round(p, 3)) # [1.0, -0.028, -0.081, -0.095, -0.152, 0.068]At lag 1, ACF and PACF are always identical (-0.028 in both) — there are no intermediate lags to control for yet, so there’s nothing to strip out. From lag 2 onward they can diverge: here PACF’s lag-2 value (-0.081) is a little more negative than ACF’s (-0.078), and by lag 4 the gap is more visible (-0.152 vs. -0.131). Neither series shows a dramatic difference yet in this small preview — but that gap, when it is large, is exactly the signal that tells you whether a relationship at a given lag is direct or just an echo of shorter-lag relationships.
A Concrete Illustration
Suppose a series is strongly related to yesterday’s value, and only to yesterday’s — there’s no direct two-day relationship at all. But because today relates to yesterday, and yesterday relates to the day before, today and the-day-before-yesterday will still show some correlation, purely as a byproduct of that chain. The ACF at lag 2 would pick up this indirect echo and show a nonzero value, even though nothing in the underlying process directly connects points two days apart. The PACF at lag 2, having already accounted for the lag-1 relationship, would correctly show close to zero — there’s no additional direct connection at that distance once the chain through yesterday is accounted for.
This is exactly why forecasting relies on both functions rather than either alone: the ACF alone can’t tell you whether a relationship at some lag is a genuine, direct feature of the process or just an inherited echo from shorter lags. The PACF is what disentangles the two — and, as Lesson 2 shows, that distinction is precisely what separates an AR process from an MA process.
Why this matters for choosing a model
An autoregressive (AR) model says today depends directly on the last p values. A moving-average (MA) model says today depends directly on the last q random shocks, not past values directly. Both can produce a series where distant lags show some correlation — but for very different structural reasons. Because the ACF and PACF respond differently to those two kinds of dependency (this is the subject of Lesson 2), comparing their shapes side by side is how you tell which kind of process — and therefore which kind of model — actually generated the data.
Practice Exercises
Exercise 1: Predict ACF vs. PACF at lag 1
Without computing anything, what’s the relationship between a series’ ACF and PACF values specifically at lag 1?
Hint
They’re always identical at lag 1. The PACF at lag k removes the effect of lags 1 through k-1 — but at lag 1, there are no lags before it to remove anything for, so “the direct relationship after controlling for intermediate lags” and “the total relationship” are the same calculation. This is confirmed in this lesson’s numbers: both ACF and PACF at lag 1 are exactly -0.028.
Exercise 2: An indirect-only relationship
A series has ACF values of 0.6 at lag 1 and 0.35 at lag 2, but its PACF at lag 2 is close to 0. What does that combination suggest about the underlying process?
Hint
It suggests the lag-2 relationship is entirely indirect — an echo carried through the strong lag-1 relationship, not a direct connection between points two steps apart. If y_t depends directly only on y_{t-1}, and y_{t-1} depends on y_{t-2}, you’d expect exactly this pattern: nonzero ACF at lag 2 (because the chain still correlates them) but PACF near zero at lag 2 (because there’s nothing additional to explain once lag 1 is accounted for). This is the textbook fingerprint of an AR(1) process, which Lesson 2 examines directly.
Exercise 3: Why not just use the ACF for everything?
If the ACF already captures “is there a relationship at this lag,” why bother computing the PACF at all?
Hint
Because the ACF alone can’t distinguish a direct relationship from an indirect, chained-through one — a strong ACF at lag 5 might mean the process genuinely depends on values 5 steps back, or it might just be an inherited echo of a strong lag-1 relationship compounding five times. The PACF resolves that ambiguity by explicitly removing the indirect contribution, which is exactly the extra information needed to tell an AR process (direct dependence on past values) from an MA process (direct dependence on past shocks) — the subject of the next lesson.
Summary
The ACF at lag k is the correlation between y_t and y_{t-k}, including any relationship carried indirectly through the lags in between. The PACF at lag k is that same relationship with the intermediate lags’ effects stripped out — the direct connection only. The two are always identical at lag 1 (there’s nothing intermediate to remove yet) and can diverge from lag 2 onward. On Cyclepath’s stationary series, the first few lags of both are modest and close to each other (ACF and PACF within about 0.02–0.02 of one another through lag 4), which is itself useful information — the interesting structure, as Lesson 4 shows, shows up further out. The core reason to compute both: the ACF alone can’t tell a direct relationship from an inherited echo, and that distinction is exactly what separates an AR process from an MA process.
Key Concepts
- ACF — total correlation between a series and its own lagged values, direct and indirect combined.
- PACF — the same relationship with indirect, chained-through effects from intermediate lags removed.
- ACF = PACF at lag 1 — always, since there are no intermediate lags to control for yet.
- Direct vs. indirect — the gap between ACF and PACF at a given lag reveals whether that lag’s relationship is genuine or inherited.
Why This Matters
Every technique in the rest of this module builds on this one distinction. An AR process and an MA process can both produce a series with nonzero autocorrelation stretching out several lags — the ACF alone genuinely can’t tell them apart. It’s specifically the shape of the PACF alongside the ACF that resolves the ambiguity, which is why Lesson 2 introduces the classic signatures side by side rather than treating either function in isolation. Next, you’ll see those signatures on synthetic AR and MA processes with known structure, so you know exactly what to look for before reading Cyclepath’s real plot.
Next Steps
Continue to Lesson 2 - Reading the Signatures: AR vs MA
Learn the classic ACF/PACF signatures that separate an AR process from an MA process, demonstrated on synthetic data with known structure.
Back to Module Overview
Return to the Autocorrelation: ACF and PACF module overview
Continue Building Your Skills
You now know precisely what the ACF and PACF each measure, and why the gap between them at a given lag is meaningful. Next you’ll see the payoff: the specific, memorable shapes each function takes for an AR process versus an MA process, demonstrated on synthetic series where you already know the right answer.