Temporal autocorrelation measures how strongly a time series relates to its own earlier observations. At lag k, the autocorrelation function (ACF) compares observations k time steps apart: ρₖ = Cov(Xₜ, Xₜ₋ₖ) / √[Var(Xₜ)Var(Xₜ₋ₖ)]. Plotting this value across lags reveals which past values may help explain current values. section 7.3.7
An ACF plot shows correlations by lag, with a shaded confidence interval; bars outside it suggest significant autocorrelation. A gradual decline can indicate persistent dependence. The partial autocorrelation function (PACF) instead measures each lag’s direct relationship after accounting for earlier lags. Lag zero compares an observation with itself, so inspect nonzero lags when assessing dependence on the past. section 7.3.7 section 7.3.8
Check dependence before fitting ARIMA
Set aside the test observations, then inspect ACF and PACF on the training series. If the original series is nonstationary, calculate first differences with `train.diff().dropna()` and compare the plots again. In the closing-price example, an augmented Dickey–Fuller test returned p = 0.576 for the original training series and approximately 1.25 × 10⁻¹⁶ after differencing. Use the plots alongside that stationarity check, rather than treating visible correlations alone as proof that preprocessing worked. section 7.3.7
>>> 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
Python code places original and differenced ACF and PACF plots side by side, making changes in lagged dependence visible. section 7.3.7
Autocorrelation analysis informs ARIMA’s autoregressive and moving-average choices: lagged observations contribute to the AR component, while lagged forecast errors contribute to the MA component. The illustrated model uses `ARIMA(train, order=(1, 1, 0))`: one AR lag, first-order differencing, and no MA term. Check significant nonzero-lag patterns before transferring those settings to another series. Exponential smoothing offers a different forecasting approach, weighting past observations without explicitly modeling the series’ autocorrelation structure. section 7.3.8 section 7.3.9 section 7.4.1



