Mathwords logoMathwords

Autocorrelation — Definition, Formula & Example

Autocorrelation (also called serial correlation) is the correlation between a time series and the same series shifted back by a fixed number of time steps. It tells you whether high values tend to be followed by high values (positive), by low values (negative), or by no predictable pattern.

For observations y1,y2,…,yny_1, y_2, \ldots, y_n with mean yˉ\bar{y}, the sample autocovariance at lag kk is ck=1n∑t=1n−k(yt−yˉ)(yt+k−yˉ)c_k = \frac{1}{n}\sum_{t=1}^{n-k}(y_t-\bar{y})(y_{t+k}-\bar{y}). The sample autocorrelation at lag kk is rk=ck/c0r_k = c_k / c_0, where c0c_0 is the sample variance computed with divisor nn. Every rkr_k satisfies −1≤rk≤1-1 \le r_k \le 1. For a stationary process, the population version is ρ(k)=Cov⁡(Yt,Yt+k)/Var⁡(Yt)\rho(k) = \operatorname{Cov}(Y_t, Y_{t+k}) / \operatorname{Var}(Y_t).

Key Formula

rk=∑t=1n−k(yt−yˉ)(yt+k−yˉ)∑t=1n(yt−yˉ)2r_k = \frac{\displaystyle\sum_{t=1}^{n-k}(y_t-\bar{y})(y_{t+k}-\bar{y})}{\displaystyle\sum_{t=1}^{n}(y_t-\bar{y})^2}
Where:
  • rkr_k = Sample autocorrelation at lag k
  • kk = Lag, the number of time steps between paired observations
  • yty_t = Observation at time t
  • yˉ\bar{y} = Mean of all n observations
  • nn = Number of observations in the series

Worked Example

Problem: A town records its daily high temperature for 6 days: 68, 68, 70, 70, 72, 72 (°F). Find the lag-1 autocorrelation r1r_1.
Step 1: Find the mean and each deviation from it.
yˉ=68+68+70+70+72+726=70,yt−yˉ:  −2, −2, 0, 0, 2, 2\bar{y} = \frac{68+68+70+70+72+72}{6} = 70, \qquad y_t - \bar{y}: \; -2,\,-2,\,0,\,0,\,2,\,2
Step 2: Compute the denominator. Square every deviation and add.
4+4+0+0+4+4=164+4+0+0+4+4 = 16
Step 3: Compute the numerator. Multiply each deviation by the next one (5 pairs for lag 1), add, then divide.
(−2)(−2)+(−2)(0)+(0)(0)+(0)(2)+(2)(2)=8,r1=816=0.5(-2)(-2)+(-2)(0)+(0)(0)+(0)(2)+(2)(2) = 8, \qquad r_1 = \frac{8}{16} = 0.5
Answer: r1=0.5r_1 = 0.5. This is a moderate positive autocorrelation: a warm day tends to be followed by another warm day.

Why It Matters

Least-squares regression assumes the errors are independent. In econometrics and forecasting courses, you check that assumption with the Durbin–Watson statistic, which is approximately 2(1−r1)2(1-r_1) for the residuals. Plots of rkr_k against kk (ACF plots) also help you choose ARIMA models.

Common Mistakes

Mistake: Computing r1r_1 as an ordinary Pearson correlation of the pairs (yt,yt+1)(y_t, y_{t+1}), with a separate mean for each column.
Correction: The standard sample autocorrelation uses the overall mean yˉ\bar{y} in every term. Its denominator sums over all nn observations. The Pearson shortcut usually gives a different value, especially for short series.

Related Terms