Autocorrelation

Updated: September 24, 2025

Title: Autocorrelation — what it is, how to spot it, and why it matters

Definition
– Autocorrelation (also called serial correlation or lagged correlation) measures how similar a time series is to a shifted (lagged) version of itself. In other words, it quantifies whether current values tend to be related to past values of the same series.
– Values of an autocorrelation coefficient range from −1 to +1. +1 is a perfect positive relationship (past increases map to proportional future increases), −1 is a perfect negative relationship (past increases map to proportional future decreases), and values near zero indicate little to no linear relationship.
– Important: autocorrelation tests linear dependence. A near-zero autocorrelation does not rule out nonlinear dependencies.

Quick conceptual contrast
– Correlation: relationship between two different variables (e.g., stock A vs. stock B).
– Autocorrelation: relationship of one variable with past (lagged) values of itself (e.g., stock A today vs. stock A yesterday).

Why analysts care
– In markets, positive autocorrelation in returns can indicate momentum (past positive returns tending to be followed by further gains). Negative autocorrelation might indicate mean reversion.
– Many standard statistical tests and regression procedures assume that observations are independent. Autocorrelation violates that assumption and can invalidate usual standard-error and hypothesis-testing results.

A common test
– The Durbin–Watson statistic is widely used to detect autocorrelation in regression residuals. It ranges from 0 to 4:
– Values near 0: strong positive autocorrelation.
– Values near 2: little or no autocorrelation.
– Values near 4: strong negative autocorrelation.

Worked numeric

example:

Worked numeric example:

We have five daily returns (decimal form): r = [0.010, 0.020, -0.005, 0.015, 0.000]. We’ll compute the lag‑1 autocorrelation (the correlation of each observation with the previous day).

Step 1 — compute the sample mean
mean r = (0.010 + 0.020 − 0

0.005 + 0.015 + 0.000) / 5 = 0.008.

Step 2 — compute deviations from the mean
– d1 = 0.010 − 0.008 = 0.002
– d2 = 0.020 − 0.008 = 0.012
– d3 = −0.005 − 0.008 = −0.013
– d4 = 0.015 − 0.008 = 0.007
– d5 = 0.000 − 0.008 = −0.008

Step 3 — compute the lag‑1 numerator
Use the sample autocovariance numerator for lag 1:
numerator = Σ_{t=2..5} (d_t × d_{t−1})
– t=2: 0.012 × 0.002 = 0.000024
– t=3: −0.013 × 0.012 = −0.000156
– t=4: 0.007 × (−0.013) = −0.000091
– t=5: −0.008 × 0.007 = −0.000056
Sum (numerator) = 0.000024 − 0.000156 − 0.000091 − 0.000056 = −0.000279

Step 4 — compute the denominator (total sum of squares)
denominator = Σ_{t=1..5} d_t^2
– d1^2 = 0.000004
– d2^2 = 0.000144
– d3^2 = 0.000169
– d4^2 = 0.000049
– d5^2 = 0.000064
Sum (denominator) = 0.000430

Step 5 — compute lag‑1 autocorrelation
lag‑1 autocorr = numerator / denominator = −0.000279 / 0.000430 ≈ −0.649

Interpretation
– The lag‑1 autocorrelation is about −0.65, indicating moderately strong negative autocorrelation between consecutive daily returns in this tiny sample. Negative autocorrelation means positive returns tend to follow negative returns and vice versa (short‑term mean reversion).
– Caveats: n=5 is very small. Estimates are noisy; statistical tests or larger samples are needed before drawing firm conclusions.

Formula summary (sample lag‑k autocorrelation)
rho_k = [Σ_{t=k+1..n} (x_t − x̄)(x_{t−

_k)}_{t=k+1}^n (x_t − x̄)(x_{t−k} − x̄)] / [Σ_{t=1}^n (x_t − x̄)^2]

Notes on that formula
– x̄ is the sample mean.
– The numerator sums cross‑products for pairs separated by lag k.
– The denominator is the total sum of squared deviations (sometimes called the variance normalizer). Some texts use an “unbiased” denominator that adjusts for n−k; the version above is the common sample autocorrelation used in ACF plots and most software.

Useful properties and examples
– For an AR(1) (first‑order autoregressive) process x_t = φ x_{t−1} + ε_t (with white‑noise ε_t), the theoretical autocorrelation at lag k is ρ_k = φ^k. Example: if φ = 0.5, then ρ1 = 0.5, ρ2 = 0.25, ρ3 = 0.125. If φ = −0.65 (as in our small sample estimate), ρ2 = (−0.65)^2 = 0.4225 (positive), showing alternating signs across lags.
– For white noise (no serial dependence), theoretical ρ_k = 0 for k ≥ 1.

Assessing statistical significance
– Approximate standard error for a sample autocorrelation at lag k under the null of white noise is about 1/√n for large n, where n is the number of observations. A common approximate 95% pointwise confidence band is ±1.96/√n. Use caution: this ignores dependence between lags.
– For joint testing of multiple lags, use the Ljung–Box Q test. The Ljung–Box statistic for m lags is
Q = n(n + 2) Σ_{k=1}^m ρ_k^2 / (n − k),
which is approximately χ^2 distributed with m degrees of freedom under the null of no serial correlation up to lag m.
– For regression residuals, the Durbin–Watson statistic tests for first‑order serial correlation. For large samples, DW ≈ 2(1 − ρ1).

Practical step‑by‑step checklist for computing and interpreting autocorrelation
1. Check stationarity. If the series has a trend or unit root, difference or detrend first. Autocorrelations of nonstationary data can be misleading.
2. Demean the data (subtract the sample mean). Many implementations do this automatically.
3. Choose maximum lag m to inspect (common choices: m ≈ 10–40 depending on frequency and sample size).
4. Compute sample autocorrelations ρ_k for k = 1..m.
5. Plot the autocorrelation function (ACF) with approximate confidence bands ±1.96/√n.
6. Optional: compute the partial autocorrelation function (PACF) to identify direct effects controlling for intermediate lags.
7. Apply Ljung–Box to test joint significance up to m lags.
8. Interpret results in light of economics and market microstructure (seasonality, trading hours, bid‑ask bounce).

Worked numeric illustration (continuing earlier small‑sample context)
– We estimated ρ1 ≈ −0.65 from n = 5 observations. The approximate 95% pointwise confidence band is ±1.96/√5 ≈ ±0.876. Our estimate (−0.65) lies inside that band, so with such a small sample we cannot reject the null of zero autocorrelation at conventional levels. This illustrates why larger samples are required for reliable inference.

Common pitfalls and caveats
– Small sample sizes: autocorrelation estimates are noisy; confidence bands are wide.
– Nonstationarity (trends, structural breaks) produces spurious autocorrelations. Test for unit roots and remove trends as needed.
– Seasonality: periodic effects produce spikes at seasonal lags (e.g., weekly patterns in daily data). Account for seasonality before interpreting.
– Market microstructure: high‑frequency return series can show negative autocorrelation from bid‑ask bounce or asynchronous trading; these are microstructure artifacts, not necessarily exploitable signals.
– Heterosk

edasticity: time-varying variance (heteroskedasticity) in returns inflates or deflates the sampling variability of autocorrelation estimates. If the variance changes over time—common in financial series—standard confidence bands based on constant-variance assumptions are misleading. Use heteroskedasticity-robust methods (e.g., Newey–West standard errors) or tests designed for conditional heteroskedasticity (e.g., ARCH LM test) before making inference.

Other useful tests and measures
– Ljung–Box Q test (portmanteau test): checks whether a group of autocorrelations up to lag m are jointly zero. Formula:
Q = n(n + 2) sum_{k=1}^m r_k^2 / (n − k),
where n is sample size and r_k is the sample autocorrelation at lag k. Under the null of no autocorrelation, Q ≈ χ^2(m).
– Durbin–Watson statistic: used in regression residuals to detect first-order autocorrelation. For large samples, DW ≈ 2(1 − ρ̂1), where ρ̂1 is the sample lag‑1 autocorrelation of residuals. Values near 2 suggest no first-order autocorrelation; below 2 indicate positive autocorrelation.
– Partial autocorrelation function (PACF): measures the correlation at lag k after removing linear effects of intervening lags. PACF cuts off after p lags for an AR(p) process, so it’s useful for selecting autoregressive order.
– ARCH/GARCH diagnostics: autocorrelation in squared returns indicates volatility clustering; test with Engle’s ARCH LM test and model with ARCH/GARCH families.

Worked numeric example — Ljung–Box
Suppose n = 100 observations and sample autocorrelations r1 = 0.12, r2 = 0.05, r3 = 0.02. Choose m = 3.
1. Compute r_k^2/(n − k):
– k=1: 0.12^2 / 99 = 0.0144 / 99 ≈ 0.0001455
– k=2: 0.05^2 / 98 = 0.0025 / 98 ≈ 0.0000255
– k=3: 0.02^2 / 97 = 0.0004 / 97 ≈ 0.0000041
2. Sum = 0.0001751. Multiply by n(n+2) = 100×102 = 10,200:
Q ≈ 10,200 × 0.0001751 ≈ 1.78.
3. Compare to χ^2(3) critical value ≈ 7.815 at 5% significance. Since 1.78 < 7.815, fail to reject the null: no evidence of autocorrelation up to lag 3.

Modeling and forecasting implications
– If ACF shows slow decay and PACF has a sharp cutoff at lag p, consider an AR(p) model