AI Glossary / Time series and signal processing / Intermediate
Autocorrelation
Definition
Autocorrelation is the correlation between a variable and a time-shifted version of itself. For a weakly stationary process with nonzero finite variance, lag-k autocorrelation is the covariance between observations k periods apart divided by their common variance. Sample autocorrelation estimates this relationship from an observed ordered series using a specified calculation convention.
What it means
Daily demand may resemble yesterday's demand, or measurements may tend to alternate above and below a baseline. Autocorrelation quantifies linear association across a chosen separation, called the lag. A lag of one means one observation interval, which could be a minute, day or month depending on the data.
Positive values indicate same-direction association relative to the mean; negative values indicate opposite-direction association. The value at one lag need not resemble the value at another. Autocorrelation describes a pattern, not its cause, and it does not measure every possible form of dependence. A zero value can coexist with nonlinear relationships.
How it works
For a common sample estimator, subtract the overall sample mean from each observation. Multiply deviations for pairs separated by k periods and sum those products. Divide by the sum of squared deviations across the full series. This is the convention used in the worked example.
Other estimators adjust the covariance denominator for the smaller number of pairs at longer lags, and a Pearson correlation of two shortened vectors can produce a different number. State the convention when reproducing results. Ensure observations follow the intended time spacing; deleting missing periods can change what a lag means. Inspect trends, seasonality and changes in variance before treating a sample coefficient as evidence of a stationary process.
Three practical examples
1. Demand exploration: A planner examines whether weekly sales relate to sales one or several weeks earlier. This helps identify candidate forecasting structure without establishing a causal explanation.
2. Model diagnostics: An analyst checks autocorrelation in one-step residuals after fitting a forecasting model. Remaining patterns suggest aspects of the series may still be unexplained.
3. Measurement uncertainty: A quality team evaluates whether closely spaced readings provide largely new information or remain strongly related. This informs how uncertainty about an average is assessed.
Think of it this way
Think of comparing a recorded melody with the same recording shifted forward by a few beats. Some shifts line up recurring features better than others. Autocorrelation provides a numerical version of that comparison for deviations from a mean, although its statistical interpretation depends on the data and the estimator rather than on visual resemblance alone.
Worked example
Take an original five-observation sequence: 2, 4, 3, 5 and 6. The mean is 4, giving deviations -2, 0, -1, 1 and 2. Their squared sum is 4 + 0 + 1 + 1 + 4 = 10.
At lag one, multiply adjacent deviations: (-2 × 0) + (0 × -1) + (-1 × 1) + (1 × 2) = 0 + 0 - 1 + 2 = 1. The stated sample estimator therefore gives r1 = 1 / 10 = 0.10.
At lag two, the products are (-2 × -1) + (0 × 1) + (-1 × 2) = 2 + 0 - 2 = 0, giving r2 = 0. These calculations demonstrate the estimator, not evidence that the underlying process has exactly those correlations. Five observations are far too little to establish a dependable lag pattern, and the visible upward movement deserves investigation rather than an automatic stationarity assumption.
Illustrative case study
Fictional case: Lakeside Analytics evaluates hourly machine readings before building an AI warning system. The team initially treats each row as an independent training example. An autocorrelation analysis shows that nearby readings share substantial information, while shift-change periods have a different pattern.
The team preserves timestamps, investigates the operational schedule and designs evaluation splits that respect time. It also checks residual dependence after fitting candidate models. The resulting report distinguishes the raw data's persistence from the errors left by each model. It does not claim that a large number of rows necessarily represents the same number of independent operating situations.
Common misconceptions and mistakes
Autocorrelation is not cross-correlation between two different series. It is also not the partial autocorrelation, which addresses a different relationship after accounting for intervening lags. A high value does not prove that earlier observations physically cause later ones.
A sample coefficient near zero does not prove independence or absence of useful nonlinear structure. A large value can reflect trend or seasonality rather than a stationary short-memory mechanism. Do not assume every coefficient outside a plotted reference band is a separate discovery, especially when examining many lags. Finally, estimator and missing-data choices can change reported values.
Business use
Autocorrelation helps businesses choose forecasting approaches, evaluate measurement practices and challenge assumptions behind uncertainty reports. It can reveal why randomly shuffled evaluations make a model appear stronger than it will be on later data.
The practical question is what the dependence means for the decision. For staffing, a recurring weekly pattern may support scheduling; for monitoring, persistent errors may signal model inadequacy. Combine autocorrelation with time plots, process knowledge and out-of-sample evaluation. It is a diagnostic aid rather than a complete model-selection rule or a standalone forecast.
People also ask
What is lag zero autocorrelation?
It is one for a nondegenerate series under the usual normalization.
Can autocorrelation be negative?
Yes. Opposite-direction linear association can occur at a specified lag.
Does lag one always mean yesterday?
No. It means one observation interval in the chosen series.
Can a constant series have the usual autocorrelation coefficient?
Its zero variance makes the standard normalization undefined.
Check your understanding
What mean is used in the example?
Answer: The overall sample mean, 4.
What is its lag-one numerator?
Answer: It is 1, yielding r1 = 0.10.
Why should a reproduction state its estimator?
Answer: Different denominator and centering conventions can give different sample values.
Related terms
- Autocorrelation function
- Partial autocorrelation
- Stationarity
- White noise
- lag
- cross-correlation
- serial dependence
- residual analysis
Learn next
Learn next how the autocorrelation function displays relationships across many lags, and how its interpretation changes for raw observations versus residuals. Then study temporal validation and the distinction between uncorrelated and independent data.
More in Time series and signal processing
- Assumed-density filter - An assumed-density filter is a sequential Bayesian approximation method that keeps the evolving probability distribution within a chosen manageable family.
- Augmented Lagrangian - An augmented Lagrangian is an optimization function that combines the original objective, multiplier terms for constraints and an additional penalty for...
- Autocorrelated errors - Autocorrelated errors are model errors that are correlated with errors at other times or ordered positions.
- B-splines - B-splines are basis functions used to represent piecewise-polynomial curves and surfaces.
- Backward shift operator - The backward shift operator is a notation that moves a time-series value back by one observation period.
- Box-Jenkins methodology - The Box-Jenkins methodology is an iterative approach to building time-series models, especially ARMA and ARIMA models, through identification, parameter...
Sources
NIST/SEMATECH, Autocorrelation: https://www.itl.nist.gov/div898/handbook/eda/section3/eda35c.htm . statsmodels developers, acf documentation: https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.acf.html . These primary technical references specify sample calculation and implementation choices. The short sequence is original and independently checked; no inference about a population process is claimed.
Previous: Autocorrelated errors Next: Autocorrelation function