Lesson 2 of 15

Partial Autocorrelation (PACF)

Partial Autocorrelation (PACF)

The Partial Autocorrelation Function (PACF) at lag k measures the correlation between xs[t] and xs[t-k] after removing the effects of all intermediate lags.

PACF is computed using the Levinson-Durbin recursion on the Yule-Walker equations:

  1. φ[1][1] = acf(xs, 1)
  2. For each k ≥ 2:
    • φ[k][k] = (acf(k) - Σ φ[k-1][j] * acf(k-j)) / (1 - Σ φ[k-1][j] * acf(j))
    • φ[k][j] = φ[k-1][j] - φ[k][k] * φ[k-1][k-j] for j = 1..k-1
  3. pacf(xs, k) = φ[k][k]

PACF cuts off at the AR order — a PACF that drops to zero after lag p suggests an AR(p) model.

Task

Implement pacf(xs, lag) using the Levinson-Durbin recursion.

  • pacf(xs, 0) = 1.0
  • pacf(xs, 1) = acf(xs, 1)
  • For higher lags, use the Yule-Walker approach above
Python runtime loading...
Loading...
Click "Run" to execute your code.