Time Series • Statistics Background for Forecasting
Time Series / P3.03 Calculate and Plot PACF

P3.03 Calculate and Plot PACF

Practical 3 Statistics Background for Forecasting

Plot the partial autocorrelation function of an AR-like constructed series.

Practical / Solution

P3.03 Calculate and Plot PACF

Problem Statement

Plot the partial autocorrelation function of an AR-like constructed series.

Learning Outcomes

  • Compute PACF.
  • Contrast PACF with ACF.

Theory

Partial autocorrelation at lag k is the correlation after removing the linear effect of lags 1 to k-1. For a pure AR(p) process, PACF tends to cut off after lag p, while ACF tails off.

Dataset / Data Source

Constructed AR(1)-like series using a recursion. Teaching data.

Analysis / Program

import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.graphics.tsaplots import plot_pacf rng = np.random.default_rng(5) e = rng.normal(size=120) y = np.zeros(120) for t in range(1, 120): y[t] = 0.7 * y[t-1] + e[t] s = pd.Series(y) plot_pacf(s, lags=15, method="ywm", title="PACF of AR(1)-like series") plt.tight_layout() plt.show()

Expected Output

A PACF plot. Lag 1 should dominate; later lags should be smaller. Finite samples will not be textbook-perfect.

Result / Interpretation

A large PACF at lag 1 and small later PACF values is consistent with a simple AR(1) idea. This is educational pattern recognition, not a proof.

Note

PACF helps suggest autoregressive order; it does not replace residual checks.