- The Partial Autocorrelation Function (PACF) measures the correlation between a time series and its lagged values, after removing the effects of all...
- **Similar:** [ACF](../acf/Acf.md), [LinReg](../linreg/LinReg.md) | **Trading note:** Partial autocorrelation; isolates direct lag relationships. Used for ARIMA model order selection.
The Partial Autocorrelation Function (PACF) measures the correlation between a time series and its lagged values, after removing the effects of all intermediate lags. While ACF shows total correlation at each lag, PACF isolates the direct correlation, making it essential for AR model identification.
## Historical Context
The partial autocorrelation concept emerged from regression theory, where researchers needed to isolate the direct effect of a variable while controlling for confounding factors. The Durbin-Levinson algorithm (1960) provided an efficient recursive method to compute PACF, reducing the computational burden from solving a new system of equations for each lag.
In time series analysis, PACF became a cornerstone of the Box-Jenkins methodology (1970) for ARIMA model identification. While ACF helps identify MA order, PACF is the primary tool for identifying AR order.
## Architecture & Physics
The PACF indicator uses the Durbin-Levinson recursion to efficiently compute partial autocorrelations. This avoids the need to solve separate regression equations for each lag, instead building up the solution recursively from ACF values.
### Core Components
1.**RingBuffer**: Maintains the sliding window of `period` values
2.**ACF Computation**: Calculates all autocorrelations up to the target lag
3.**Durbin-Levinson Recursion**: Computes PACF from ACF values
4.**Coefficient Arrays**: Temporary storage for recursion (stack-allocated for small lags)
## Mathematical Foundation
### Partial Autocorrelation Definition
The partial autocorrelation at lag $k$, denoted $\phi_{kk}$, is the correlation between $X_t$ and $X_{t-k}$ after removing the linear dependence on $X_{t-1}, X_{t-2}, \ldots, X_{t-k+1}$.
Equivalently, $\phi_{kk}$ is the last coefficient in the AR(k) regression:
| DIV | K + 2 | ACF ratios, recursion denominators |
Where N = period, K = lag.
## Validation
| Library | Status | Notes |
| :--- | :--- | :--- |
| **TA-Lib** | N/A | Not available in TA-Lib |
| **Skender** | N/A | Not available in Skender |
| **Tulip** | N/A | Not available in Tulip |
| **Mathematical** | ✅ | Validated against theoretical properties |
PACF is validated through mathematical properties:
- $\phi_{11} = r_1$ (PACF at lag 1 equals ACF at lag 1)
- Bounded output [-1, 1]
- Constant series returns 0
- AR(1) process produces PACF ≈ φ at lag 1, ≈ 0 for higher lags
## Common Pitfalls
1.**Period vs Lag Constraint**: Period must be greater than `lag + 1`. Insufficient data produces undefined or unstable results.
2.**PACF ≠ ACF**: A common confusion is treating PACF and ACF identically. While $\phi_{11} = r_1$, higher-order PACF values differ significantly from ACF.
3.**Warmup Period**: PACF requires a full window (`period` values) plus sufficient data for stable ACF estimates. Values during warmup are unreliable.
4.**Numerical Stability**: For very high lags, the Durbin-Levinson recursion can accumulate numerical errors. The denominator approaching zero indicates potential instability.
5.**AR vs MA Confusion**: Sharp PACF cutoff indicates AR; sharp ACF cutoff indicates MA. Using the wrong criterion leads to model misspecification.
6.**Significance Testing**: PACF values should be tested against confidence bounds. For white noise, 95% confidence bounds are approximately $\pm 1.96/\sqrt{n}$.
7.**Non-Stationarity**: Like ACF, PACF assumes stationarity. Trending data should be differenced first.