Mean reversion, and how to find it where there is none
The Ornstein–Uhlenbeck process began as a model of a Brownian particle slowed by friction. In finance it describes spreads that snap back, and its standard estimator finds that behavior in pure random walks.
A random walk has no memory of where it has been. Many things in markets do: the gap between two closely related prices, an interest rate, the premium of a perpetual future over spot. They wander, but they get pulled back. The standard model for that pull came from physics, and it has a trap built into how it is usually estimated.
A particle with friction
In 1908 Langevin wrote down Newton’s law for a small particle in a fluid: a viscous friction force proportional to its velocity plus an irregular force from the molecules around it [1]. Uhlenbeck and Ornstein worked out the statistics of its solution in 1930 [2]. Written for a quantity that is pulled toward a level , the equation is
The first term is the friction: the further is from , the harder it is pushed back, at rate . The second is the same Brownian noise as in geometric Brownian motion. The solution is a Gaussian process with
Deviations decay exponentially, so the natural summary is the half-life : how long it takes, on average, for a gap to close halfway. Noise and friction balance at a stationary spread , the same balance that sets a Brownian particle’s thermal velocity (the fluctuation–dissipation relation).
Where it shows up in markets
- Spreads between related assets. Two assets driven by the same thing can drift apart, but not for long. The spread is modeled as OU; a trade opens when it is a couple of stationary standard deviations wide.
- Interest rates. Vasicek’s 1977 short-rate model is exactly this equation [3].
- Futures basis and funding. A perpetual future is tied to spot by a funding payment that pushes the premium back toward zero. The premium behaves like a spring with noise.
Estimating it
Sampled every , the OU process is exactly an autoregression:
So the usual recipe is: regress on , read off the slope , and set . It is short, it is in every tutorial, and on a year of daily data it lies.
The trap
Feed the recipe a pure random walk (, no pull at all), one year of daily points, and repeat 20,000 times:
- 96% of the samples give a slope , i.e. “mean reversion”;
- the median implied half-life is 40 trading days;
- 85% of samples report a half-life under six months, short enough to look tradeable.
When there is reversion the estimate is still too fast. With a true per year (half-life 35 trading days), the median estimate is a half-life of 20 days.
This is a known small-sample bias of the autoregression slope, studied since Hurwicz [4] and worked out to first order by Kendall and by Marriott and Pope [5, 6], and it is the reason unit-root tests such as Dickey–Fuller need their own critical values [7]. With the mean estimated from the sample, the first-order bias is , which puts the spurious speed of a random walk at about per year for years of data. That matches the simulation, and it contains the uncomfortable part:
The trap on real prices
The “ETH/BTC” tab runs the same recipe on the ratio of two crypto prices, Binance perpetual daily closes from September 2021 to October 2026. Over those five years the ratio fell from 0.078 to 0.029: whatever it is, it did not revert. An augmented Dickey–Fuller test on the full series agrees (, no evidence of mean reversion), and the full-sample fit gives a half-life of 524 days.
Now fit one-year windows, as a trader looking at “the last year” would. Across 101 windows, 15 days apart, the median fitted half-life is 60 days, and 89% of windows report a half-life under six months. The augmented Dickey–Fuller test rejects a random walk in only 3% of the same windows. The regression finds a spring almost every time; the test almost never does.
What to do instead
- Test before you fit. Run an augmented Dickey–Fuller test (or a cointegration test for a pair) with its proper critical values, not a regression -statistic read against a normal table.
- Count half-lives, not rows. Ask how many times the estimated half-life fits in the sample. Fewer than about ten and the estimate is mostly bias.
- Correct or simulate. Add the first-order correction back to , or calibrate by simulating the fitted model and re-estimating it many times; the spread of those estimates is your real error bar.
- Hold out time. Fit on one period and check that the spread actually reverts in the next one.
Code
import numpy as np
def simulate_ou(theta, sigma, n, dt, reps, rng): b = np.exp(-theta * dt) if theta > 0 else 1.0 sd = sigma * np.sqrt((1 - b**2) / (2 * theta)) if theta > 0 else sigma * np.sqrt(dt) x = np.zeros((reps, n)) shocks = rng.standard_normal((reps, n)) * sd for t in range(1, n): x[:, t] = b * x[:, t - 1] + shocks[:, t] return x
def fitted_theta(x, dt): x0 = x[:, :-1] - x[:, :-1].mean(axis=1, keepdims=True) x1 = x[:, 1:] - x[:, 1:].mean(axis=1, keepdims=True) b = (x0 * x1).sum(axis=1) / (x0**2).sum(axis=1) return -np.log(np.clip(b, 1e-9, 1 - 1e-12)) / dt
rng = np.random.default_rng(3)dt = 1 / 252theta_hat = fitted_theta(simulate_ou(0.0, 1.0, 253, dt, 20_000, rng), dt)half_life_days = np.log(2) / theta_hat * 252print(f"random walk: median half-life {np.median(half_life_days):.0f} days, " f"{(half_life_days < 126).mean():.0%} under six months")Takeaway
The Ornstein–Uhlenbeck process is the simplest honest model of something that gets pulled back, and its parameters have physical meaning: a spring constant and a temperature. The hard part is not the model but the speed of the spring. Estimate it on a short window and you will find a spring even in a random walk.
Data
Binance Data Collection, USDⓈ-M futures daily klines (ETHUSDT, BTCUSDT), data.binance.vision.
References
- P. Langevin, “Sur la théorie du mouvement brownien,” Comptes Rendus de l’Académie des Sciences (Paris) 146, 530–533 (1908). English translation: D. S. Lemons and A. Gythiel, American Journal of Physics 65(11), 1079–1081 (1997), doi:10.1119/1.18725
- G. E. Uhlenbeck and L. S. Ornstein, “On the theory of the Brownian motion,” Physical Review 36(5), 823–841 (1930). doi:10.1103/PhysRev.36.823
- O. Vasicek, “An equilibrium characterization of the term structure,” Journal of Financial Economics 5(2), 177–188 (1977). doi:10.1016/0304-405X(77)90016-2
- L. Hurwicz, “Least-squares bias in time series,” in T. C. Koopmans (ed.), Statistical Inference in Dynamic Economic Models, Cowles Commission Monograph 10, Wiley, 365–383 (1950).
- M. G. Kendall, “Note on bias in the estimation of autocorrelation,” Biometrika 41(3/4), 403–404 (1954). doi:10.1093/biomet/41.3-4.403
- F. H. C. Marriott and J. A. Pope, “Bias in the estimation of autocorrelations,” Biometrika 41(3/4), 390–402 (1954). doi:10.1093/biomet/41.3-4.390
- D. A. Dickey and W. A. Fuller, “Distribution of the estimators for autoregressive time series with a unit root,” Journal of the American Statistical Association 74(366), 427–431 (1979). doi:10.1080/01621459.1979.10482531