Markets: A Rigorous Course

13A.7 The Ornstein–Uhlenbeck spread: estimation, half-life and precision

Core about 15 min

Motivation

Once a spread is judged stationary, a trader needs three numbers: the level it reverts to, how fast, and how noisy. The OU process supplies all three, and its estimation errors are larger than most backtests admit.

13A.7.1Model and exact discretisation#

dXt=κ(θ−Xt) dt+σ dWt,κ>0.(13A.22)dX_t = \kappa(\theta - X_t)\,dt + \sigma\,dW_t, \qquad \kappa>0. \tag{13A.22}

Apply Itô to eκtXte^{\kappa t}X_t: d(eκtXt)=κθeκtdt+σeκtdWtd(e^{\kappa t}X_t) = \kappa\theta e^{\kappa t}dt + \sigma e^{\kappa t}dW_t. Integrate over [t,t+Δ][t, t+\Delta]:

Xt+Δ=θ+(Xt−θ)e−κΔ+σ∫tt+Δe−κ(t+Δ−s)dWs.X_{t+\Delta} = \theta + (X_t-\theta)e^{-\kappa\Delta} + \sigma\int_t^{t+\Delta}e^{-\kappa(t+\Delta-s)}dW_s.

The stochastic integral is Gaussian with mean zero and variance σ2(1−e−2κΔ)/(2κ)\sigma^2(1-e^{-2\kappa\Delta})/(2\kappa) by the Itô isometry. This is M10 (10.18). So the sampled series is an exact Gaussian AR(1):

Xt+Δ=a+b Xt+et+Δ,b=e−κΔ,a=θ(1−b),σe2=σ2(1−b2)2κ.(13A.23)X_{t+\Delta} = a + b\,X_t + e_{t+\Delta},\qquad b = e^{-\kappa\Delta},\quad a = \theta(1-b),\quad \sigma_e^2 = \frac{\sigma^2(1-b^2)}{2\kappa}. \tag{13A.23}

The stationary law is N(θ,σ2/(2κ))N(\theta, \sigma^2/(2\kappa)), and the stationary standard deviation equals σe/1−b2\sigma_e/\sqrt{1-b^2}. The half-life is ln⁡2/κ\ln 2/\kappa (M10 (10.19)).

13A.7.2Maximum likelihood#

Proposition 13A.7exact conditional MLE

Given X0,…,XnX_0,\dots,X_n at spacing Δ\Delta, the maximum-likelihood estimates conditional on X0X_0 are

κ^=−ln⁡b^Δ,θ^=a^1−b^,σ^=σ^e2κ^1−b^2,(13A.24)\hat\kappa = -\frac{\ln\hat b}{\Delta},\qquad \hat\theta = \frac{\hat a}{1-\hat b},\qquad \hat\sigma = \hat\sigma_e\sqrt{\frac{2\hat\kappa}{1-\hat b^2}}, \tag{13A.24}

where (a^,b^)(\hat a,\hat b) are OLS estimates from regressing Xt+ΔX_{t+\Delta} on (1,Xt)(1, X_t) and σ^e2=SSR/n\hat\sigma_e^2 = \text{SSR}/n, provided 0<b^<10<\hat b<1.

Proof

By (13A.23) the conditional log-likelihood is −n2ln⁡(2πσe2)−12σe2∑(Xt+Δ−a−bXt)2-\tfrac n2\ln(2\pi\sigma_e^2) - \tfrac{1}{2\sigma_e^2}\sum(X_{t+\Delta}-a-bX_t)^2, maximised over (a,b)(a,b) by OLS and over σe2\sigma_e^2 by SSR/n\text{SSR}/n. The map (κ,θ,σ)↦(a,b,σe)(\kappa,\theta,\sigma)\mapsto(a,b,\sigma_e) of (13A.23) is a bijection from (0,∞)×R×(0,∞)(0,\infty)\times\mathbb R\times(0,\infty) onto {0<b<1}×R×(0,∞)\{0<b<1\}\times\mathbb R\times(0,\infty), and maximum likelihood is invariant under reparametrisation.∎

If b^≥1\hat b\ge1 there is no OU fit: the data are more consistent with a random walk or an explosive process. fit_ou raises an error in that case rather than return a negative κ\kappa. The exact (unconditional) likelihood adds the stationary density of X0X_0; the difference is negligible for long samples. The Euler approximation κ≈(1−b^)/Δ\kappa\approx(1-\hat b)/\Delta is the first-order expansion of −ln⁡b^/Δ-\ln\hat b/\Delta; it understates κ\kappa by a relative amount of about κΔ/2\kappa\Delta/2, which is tiny for daily data and slow spreads.

13A.7.3How precisely is κ\kappa known?#

Proposition 13A.8precision and bias of κ^\hat\kappa, first order

With nn observations spanning S=nΔS = n\Delta and κΔ\kappa\Delta small,

se⁡(κ^)κ≈2κS,Eκ^−κκ≈4κS.(13A.25)\frac{\operatorname{se}(\hat\kappa)}{\kappa}\approx\sqrt{\frac{2}{\kappa S}},\qquad \frac{\mathbb E\hat\kappa - \kappa}{\kappa}\approx \frac{4}{\kappa S}. \tag{13A.25}
Proof

For a stationary AR(1), Var⁡(b^)≈(1−b2)/n\operatorname{Var}(\hat b)\approx(1-b^2)/n. The delta method on κ^=−ln⁡b^/Δ\hat\kappa = -\ln\hat b/\Delta gives se⁡(κ^)≈se⁡(b^)/(bΔ)\operatorname{se}(\hat\kappa)\approx\operatorname{se}(\hat b)/(b\Delta). With 1−b2=1−e−2κΔ≈2κΔ1-b^2 = 1 - e^{-2\kappa\Delta}\approx2\kappa\Delta and b≈1b\approx1: se⁡(κ^)2≈2κΔ/(nΔ2)=2κ/S\operatorname{se}(\hat\kappa)^2\approx 2\kappa\Delta/(n\Delta^2) = 2\kappa/S. For the bias, Kendall's approximation (M10 · 10.7.2) is Eb^−b≈−(1+3b)/n≈−4/n\mathbb E\hat b - b\approx-(1+3b)/n\approx -4/n, so Eκ^−κ≈(4/n)/(bΔ)≈4/S\mathbb E\hat\kappa - \kappa\approx (4/n)/(b\Delta)\approx 4/S.∎

So the precision depends on κS\kappa S, the number of mean-reversion time units in the sample (about 1.44 times the number of half-lives observed), and not on the sampling frequency.

Worked example

A daily spread with b^=0.97\hat b = 0.97 and σ^e=0.01\hat\sigma_e = 0.01 (log units), Δ=1/250\Delta = 1/250 year:

  • κ=−250ln⁡0.97=7.615\kappa = -250\ln 0.97 = 7.615 per year; half-life ln⁡2/κ=0.0910\ln2/\kappa = 0.0910 years =22.76= 22.76 trading days (the approximation −ln⁡2/(b−1)-\ln 2/(b-1) gives 23.10);
  • σ=0.012×7.615/(1−0.972)=0.1605\sigma = 0.01\sqrt{2\times7.615/(1-0.97^2)} = 0.1605 per year\sqrt{\text{year}}; stationary standard deviation 0.01/1−0.9409=0.04110.01/\sqrt{1-0.9409} = 0.0411, i.e. about 4.1%.
  • With two years of data (n=500n = 500), κS=0.0305×500=15.2\kappa S = 0.0305\times500 = 15.2. By (13A.25) the relative standard error is about 36% and the upward bias about 26%. A simulation of 2,000 such samples (m13a_ou.py, computed for this course) gives a mean κ^/κ\hat\kappa/\kappa of 1.27, a median of 1.20 and a standard deviation of 0.44. Inverting that sampling distribution, the point estimate "half-life 23 days" from two years of data is consistent with a true half-life from about 19 to 38 days (16th to 84th percentiles of the simulated κ^/κ\hat\kappa/\kappa, 4,000 draws) and from about 14 to 52 days at the 2.5th and 97.5th percentiles.

Practitioner notes

  • Report the half-life with an interval. Bias-correct b^\hat b (M10 · 10.7.2) before converting to κ\kappa.
  • A half-life of a few days estimated on intraday data from one month is not evidence of anything: κS\kappa S is small whatever the number of bars.
  • If the half-life exceeds the period you are willing to hold a losing trade, the spread is not tradeable for you, whatever the test says.

Create a free account

Reading is open to everyone. An account keeps your progress, answers, notes and code drafts, and gives you the study plan, the journals and the simulator. Running code needs an account approved for it.