liveBook · Manning

Partial autocorrelation function

As explained in Statistics Every Programmer Needs

The partial autocorrelation function measures the correlation between a time-series observation and a lagged observation after accounting for intervening lags.

The partial autocorrelation function (PACF) measures the relationship between a time-series observation and a value k lags earlier after accounting for intervening lags. Unlike the autocorrelation function (ACF), which displays correlation at each lag, PACF helps distinguish lags with a direct relationship to the current observation. Its plot is useful when choosing the autoregressive order p of an ARIMA model. section 7.3.7 section 7.3.8

Use PACF as part of a stationarity and model-selection workflow:

  • Separate training and test observations before preprocessing; inspect the training series with ACF and PACF plots. section 7.3.7
  • Check stationarity. In the closing-price example, an augmented Dickey–Fuller test returned p = 0.576 for the training series; first-order differencing produced a series with p ≈ 1.25 × 10⁻¹⁶. section 7.3.7
  • Compare ACF and PACF before and after differencing. On the differenced series, inspect significant nonzero lags when considering autoregressive terms; treat the resulting order as a candidate to evaluate, not a decision made by a plot alone. section 7.3.7 section 7.3.8
>>> fig, axes = plt.subplots(2, 2)     #1
>>> plot_acf(train, ax = axes[0, 0])   #2
>>> axes[0, 0].set_title('ACF - Original')     #3
>>> plot_pacf(train, ax = axes[0, 1])     #4
>>> axes[0, 1].set_title('PACF - Original')     #5
>>> plot_acf(train_diff, ax = axes[1, 0])     #6
>>> axes[1, 0].set_title('ACF - Differenced')   #7
>>> plot_pacf(train_diff, ax = axes[1, 1])    #8
>>> axes[1, 1].set_title('PACF - Differenced')    #9
>>> plt.tight_layout()     #10
>>> plt.show()   #11

This Python listing uses statsmodels to place ACF and PACF plots for the original training series beside those for its first-order difference. Comparing the four plots makes the change in correlation structure visible. section 7.3.7

In a PACF plot, each vertical line is a partial autocorrelation coefficient; the shaded band is a confidence interval. Spikes outside it suggest significant partial autocorrelation. A sharp drop after the first few lags suggests that only those early lags have a substantial direct relationship with the current value. Read lag labels carefully: a lag-0 spike alone does not establish which past observation should enter an autoregressive model. section 7.3.7 section 7.3.8

PACF belongs to a model-identification approach that analyzes a series’ correlation structure. Exponential smoothing takes a different route: it applies exponentially decaying weights to past observations rather than explicitly using ACF and PACF to select model parameters. section 7.4.1

How Statistics Every Programmer Needs covers it

How deep it goes
Defines direct lag relationships and interprets plotted coefficients and confidence intervals, without deriving PACF calculations.
Examples
Compares statsmodels ACF and PACF plots for original and first-differenced closing prices, alongside augmented Dickey–Fuller results.
What it assumes
Builds from explanations of lagged correlation and stationarity while assuming a time series ready to split into training and test observations.
What you can do after
Apply it via statsmodels plots to assess significant lags and propose an autoregressive order after checking stationarity.
How it connects
Connects partial autocorrelation to autocorrelation, stationarity, differencing, and ARIMA autoregressive terms.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.