Autocorrelation — does yesterday tell you anything about today?
▸ Pretest — guess, even if you don't know
Across 20 years of S&P 500 daily returns, what does yesterday's return tell you about today's return?
A time series is not a bag of iid draws
Everything in the statistics track quietly assumed your sample was iid — independent draws from one distribution, where shuffling the data changes nothing. A time series is data where the order is information. The trading question this raises: does what happened at time tell me anything about time ? If yes, there is structure to forecast. If no, past prices are noise and half the strategies on the internet are astrology.
Autocorrelation is that question turned into a number: correlation (A2-08), applied to a series and a time-shifted copy of itself.
Lag-k autocorrelation and the ACF
The lag- autocorrelation is the correlation between the series and itself steps earlier:
The sample version pairs each observation with the one steps before it — element with , element with , and so on — which in numpy is just correlating two slices:
def autocorr(x, k):
return np.corrcoef(x[:-k], x[k:])[0, 1]
Plot for and you have the autocorrelation function (ACF) — the standard first diagnostic for any series. (Textbook ACF estimators use the full-series mean and variance for both slices rather than per-slice ones like corrcoef does; for the difference is negligible, but expect tiny mismatches against statsmodels.tsa.stattools.acf.)
Fact 1: returns are nearly uncorrelated
Compute the ACF of daily equity returns and you get spikes scattered around zero, mostly inside the noise band we build below. This is not a coincidence — it is competition. If lag-1 autocorrelation were reliably , "buy the day after an up day" would print money, everyone would do it, and the buying pressure would move today's price until the pattern vanished. Whatever linear predictability exists in liquid markets is tiny, unstable, and usually smaller than trading costs (D4-01's cost table). This is why naive "predict tomorrow's return from yesterday's" models fail: the signal they need is roughly zero by construction of a competitive market.
Fact 2: the size of returns is strongly autocorrelated
Now take the same return series and compute the ACF of or . The picture flips: strong positive autocorrelation, decaying slowly over weeks to months. This is volatility clustering — the same regime behavior you met in A2-02: turbulent days cluster together, calm days cluster together, even though the direction of each day stays unpredictable. Cont (2001) lists this pair — no linear autocorrelation in returns, slow-decaying autocorrelation in their magnitudes — among the canonical "stylized facts" of asset returns.
The trading consequence: you mostly cannot forecast tomorrow's return, but you can forecast tomorrow's volatility. That asymmetry funds entire businesses — volatility forecasting models, options pricing, and risk-based position sizing all live on Fact 2.
Is that spike real? The 1-over-root-N rule
Sample autocorrelations of finite noise are never exactly zero. Under the iid null hypothesis, the sample is approximately Normal with mean 0 and standard error . So the eyeball rule: spikes inside are consistent with pure noise. For one year of daily data, , the band is — embarrassingly wide. A lag-3 autocorrelation of estimated on a year of returns is nothing.
Two cautions from earlier lessons apply. First, with 20 lags plotted, about 1 in 20 will poke outside a 95% band by chance — the multiple-testing trap from D4-01 in miniature. The Ljung–Box test handles this properly: it aggregates the squared sample autocorrelations of the first lags into one statistic with one p-value, testing the joint null that all are zero — one honest test instead of twenty hopeful eyeballs. Second, the null assumes iid — and Fact 2 says returns are not iid (volatility clusters), which widens the true bands for return series. Treat the rule as a floor, not a verdict.
Try it
Implement autocorr(x, k): the lag-k sample autocorrelation, computed as the correlation of x[:-k] with x[k:] using np.corrcoef. The result is element [0, 1] of the 2x2 correlation matrix.
⧉ Review cardDefine lag-k autocorrelation and the ACF.
⧉ Review cardWhat are the two foundational ACF facts about asset returns?
⧉ Review cardHow do you eyeball whether a sample autocorrelation spike is real?
⧉ Review cardWhat does the Ljung-Box test do, and what problem does it fix?
Draw it
On paper, draw two ACF plots side by side for a daily stock return series, lags 1 through 20, each with the noise band at plus-or-minus drawn in: left panel the returns themselves, right panel the squared returns. Then annotate each panel with one sentence on what trading business it kills or enables.
Predict before the next lesson
Next up: white noise and random walks (D1-02). Before then, predict: if you flip a coin 1,000 times and chart the running total of heads-minus-tails, what will the chart look like? Would you be able to tell it apart from a real stock chart — and what patterns would you be tempted to draw on it?
◈ Calibration check
Could you compute a lag-k autocorrelation from scratch, state the two stylized ACF facts about returns, and explain the 2-over-root-N band?
1 = guessing · 5 = could teach it
⏻ End of lesson
Mark it read to book its 4 review cards into your deck.
Sources & further reading
- bookTsay (2010), Analysis of Financial Time Series, 3e — §2
- paperCont (2001), Empirical Properties of Asset Returns: Stylized Facts and Statistical Issues, Quantitative Finance 1