Autocorrelation is the correlation between a variable and a lagged version of itself β this month's sales compared with last month's, today's temperature compared with yesterday's. It shows up constantly in time-ordered data, and it matters because almost every standard statistical formula, from a basic confidence interval to a t-test, silently assumes observations are independent of one another. When that assumption fails, the formulas don't just give a slightly-off answer β they can give a confidently wrong one.
- The lag-k autocorrelation formula, with a full worked example
- The correlogram (ACF plot) and how to tell a real signal from noise
- Why autocorrelation breaks the independence assumption behind ordinary statistical formulas
- How it's detected and what's done about it
The Formula
For a time-ordered series xβ, xβ, ..., xβ with mean xΜ, the lag-k autocorrelation is:
This is ordinary Pearson correlation, just applied between the series and a copy of itself shifted forward by k time steps, rather than between two genuinely separate variables. rβ (lag 1) measures how strongly each value relates to the one immediately before it; rβ measures the relationship two steps back, and so on.
Worked Example
Problem: A growing app's daily active users are tracked for 30 consecutive days. The series trends upward with day-to-day momentum rather than jumping around randomly (mean xΜ = 60.13). Is there significant lag-1 autocorrelation?
Applying the formula across the full 30-day series: the numerator Ξ£(xβ β xΜ)(xβββ β xΜ) = 823.90, and the denominator Ξ£(xβ β xΜ)Β² = 911.60.
A lag-1 autocorrelation of 0.90 is very strong β each day's user count is highly predictable from the previous day's, exactly what's expected from a metric with real underlying momentum (growth doesn't reset randomly each day) rather than one bouncing independently around a fixed level.
The Correlogram and Its Significance Band
Plotting rβ against k for several lags at once produces a correlogram, also called an ACF (autocorrelation function) plot β the standard way to inspect a series for autocorrelation at a glance rather than checking one lag at a time. Not every nonzero rβ is meaningful: for a genuinely uncorrelated ("white noise") series, sample autocorrelations still fluctuate randomly around zero purely from sampling variation. The conventional approximate 95% significance band is:
For the 30-day example above, that band is Β±1.96/β30 β Β±0.358 β the observed rβ = 0.90 sits far outside it, confirming the autocorrelation is real and not just sampling noise. This band also explains a common trap with short series: a series of only n = 10 points has a much wider band (Β±1.96/β10 β Β±0.62), meaning even a fairly large-looking rβ around 0.5β0.6 can fail to clear the threshold β short time series need a correspondingly larger observed correlation before it can be trusted as a genuine pattern rather than noise.
Positive vs. Negative Autocorrelation
Positive autocorrelation (rβ > 0, as in the worked example) means values above the mean tend to be followed by more values above the mean β momentum, trending, or slow-moving cycles. Negative autocorrelation (rβ < 0) means values tend to alternate β an above-average reading followed by a below-average one, and back again. This is exactly the relationship the Durbin-Watson test's statistic captures on regression residuals specifically, where d β 2(1 β r): positive autocorrelation pushes d toward 0, negative autocorrelation pushes it toward 4, and independence keeps it near 2.
Why It Breaks Ordinary Statistical Formulas
Standard confidence interval and hypothesis-test formulas derive their precision from the number of independent observations β more independent data points genuinely means more distinct information, which is the entire premise behind the Law of Large Numbers and the shrinking of standard error as sample size grows. Autocorrelated data violates this at the source: each new observation carries less genuinely new information than an independent one would, because it's partly predictable from what came before. Applying an ordinary formula anyway typically produces a standard error that's too small and a confidence interval that's too narrow β the formula reports more precision than the data actually earned, which inflates the true Type I error rate of any hypothesis test built on top of it well above the nominal 5%.
Detecting and Handling It
Detection: the correlogram above, the Durbin-Watson test for first-order autocorrelation specifically in regression residuals, and the runs test applied to the signs of residuals in time order (catching some autocorrelation patterns the Durbin-Watson test's specific lag-1 focus can miss).
Handling it: common fixes include differencing the series (analyzing period-to-period changes instead of raw levels, which often removes a trend-driven autocorrelation), adding a lagged version of the outcome as a predictor so the model explicitly accounts for the momentum, or using heteroscedasticity- and autocorrelation-consistent (HAC) standard errors β a correction that keeps the original model but computes honest, wider standard errors that account for the correlation rather than pretending it isn't there.
Real-World Uses
Finance: the (weak-form) efficient market hypothesis predicts that a stock's returns should show essentially zero autocorrelation β past price changes shouldn't help predict future ones. Testing return series for significant autocorrelation is a standard, direct empirical test of exactly this claim.
Quality control: process-monitoring control charts generally assume independent measurements; autocorrelated process data (common when consecutive units share a slow-drifting cause, like tool wear) can trigger a wave of false alarms or mask a real shift, which is why autocorrelation is checked before control limits are trusted.
Climate and economic data: temperature, unemployment, and GDP series are all strongly autocorrelated by nature (this month resembles last month far more than a random draw would), which is precisely why specialized time series methods β rather than ordinary independence-based formulas β are the standard tool for this kind of data, as introduced in time series basics.
Common Mistakes
Treating any nonzero sample rβ as proof of real autocorrelation. As the significance band shows, some nonzero correlation is expected from chance alone, especially with a short series β always check rβ against Β±1.96/βn before concluding the pattern is genuine.
Applying ordinary confidence intervals and t-tests to time-ordered data without checking for autocorrelation first. This is the single most consequential version of the mistake described above β it silently understates real uncertainty and inflates the apparent statistical significance of results that may not be as solid as they look.
Is autocorrelation the same thing as trend?
How many lags should a correlogram show?
Does removing autocorrelation always require a specialized time series model?
Share this article
Written by
Statistics Fundamentals Editorial Team
Written and reviewed by our team of statistics educators. Content is aligned with GCSE, A-Level, AP Statistics, and undergraduate curricula.
About Statistics Fundamentals β