Quant Sandbox
DerivativesPortfolio & RiskFixed IncomeCorporate FinanceStochastic ModelsGuide
Guide
Derivatives pricing
01Forwards, calls and puts02Combining positions03Arbitrage and the forward price04Put–call parity05The one-step binomial model06Risk-neutral probabilities07Multi-step trees and backward induction08American options and early exercise09Delta and hedging10Geometric Brownian motion11The Black–Scholes formula12The Greeks: gamma, vega, theta and rho13Implied volatility and the volatility smile14Stochastic volatility and the Heston model15Static replication: Breeden–Litzenberger and Carr–Madan16Exotic options: barriers, Asians and digitals
Portfolio & risk
01Returns and volatility02Diversification and correlation03The efficient frontier and the capital market line04Risk aversion and the optimal complete portfolio05CAPM, beta and the security market line06Performance measures: Sharpe, Treynor, Jensen and information ratio07Factor models and systematic risk08Value at Risk and expected shortfall
Fixed income
01Bond prices and yields02Duration and convexity03Immunization and duration matching04Spot rates, forward rates and the yield curve05Bond futures and the cheapest-to-deliver06Interest rate swaps07Callable bonds and negative convexity08Credit risk: default probabilities and credit spreads
Corporate finance
01Interest, compounding and discounting02Annuities, perpetuities and loan amortization03Net present value and internal rate of return04The weighted average cost of capital05Capital structure and the Modigliani–Miller theorems06Discounted cash flow valuation07Relative valuation with multiples08Real options: the value of flexibility
Stochastic models
01Random walks and Brownian motion02Probability spaces, σ-algebras and random variables03Filtrations, adapted processes and stopping times04Conditional expectation and martingales05Properties of Brownian motion06The reflection principle and first passage times07The Brownian bridge08The Itô integral09Itô's lemma10Kolmogorov equations and the Feynman–Kac formula11Change of measure and Girsanov's theorem12Monte Carlo option pricing13Simulating SDEs: the Euler–Maruyama scheme14Mean reversion: Ornstein–Uhlenbeck and Vasicek15Jumps and the Merton jump-diffusion model
Knowledge graph

© 2026 Quant Sandbox · A study aid for quantitative finance

Privacy & dataNo cookies

This site does not use cookies and asks for no personal data. It keeps a few small settings in your browser's local storage — your chosen theme and language, the sidebar layout, and your progress and answers in the Guides — so it remembers them on your next visit. This data never leaves your device; clearing your browser storage removes it. Inputs you change can also be captured in the page URL, so you can share or bookmark a specific setup. The site uses Vercel Web Analytics, a privacy-friendly, cookieless service that records only anonymous, aggregated usage (such as page views) without identifying you or tracking you across other sites.

Guide/Stochastic models

Mean reversion: Ornstein–Uhlenbeck and Vasicek

Lesson 14 of 15 · 1 min read

Brownian motion from "Random walks and Brownian motion" and the stock price model built on it wander without limit: their variance grows with the horizon, and nothing pulls them back. Interest rates, volatility and credit spreads behave differently. They fluctuate, but over years they tend to return to a typical level. This lesson builds the standard model of such a process, solves it exactly with the tools of "Itô's lemma", and applies it to the short interest rate in the Vasicek model.

The Ornstein–Uhlenbeck process

Let XtX_tXt​ be the quantity of interest, for example an interest rate. The Ornstein–Uhlenbeck process is the Itô process

dXt=κ (θ−Xt) dt+σ dWt,dX_t = \kappa\,(\theta - X_t)\,dt + \sigma\,dW_t,dXt​=κ(θ−Xt​)dt+σdWt​,

with three constant parameters:

  • θ\thetaθ is the long-run level, the value the process is pulled towards.
  • κ>0\kappa > 0κ>0 is the speed of mean reversion: how strongly the gap θ−Xt\theta - X_tθ−Xt​ is closed per unit of time.
  • σ>0\sigma > 0σ>0 is the volatility: the size of the random shocks, as in "Itô's lemma".

The drift has the sign of the gap. Above θ\thetaθ the drift is negative and pushes the process down; below θ\thetaθ it is positive and pushes it up. Think of a ball attached to a spring in a stream of random kicks: the further it is pulled from its rest point, the harder the spring pulls back. Unlike geometric Brownian motion, the volatility here does not depend on the level, so the shocks have the same size everywhere.

The deterministic part

Switch off the noise, σ=0\sigma = 0σ=0. The equation becomes the ordinary differential equation dx/dt=κ(θ−x)dx/dt = \kappa(\theta - x)dx/dt=κ(θ−x), whose solution is

x(t)=θ+(x0−θ) e−κt.x(t) = \theta + (x_0 - \theta)\,e^{-\kappa t}.x(t)=θ+(x0​−θ)e−κt.

The gap to θ\thetaθ shrinks exponentially. The time after which half of the gap is left solves e−κt=1/2e^{-\kappa t} = 1/2e−κt=1/2 and is called the half-life:

t1/2=ln⁡2κ.t_{1/2} = \frac{\ln 2}{\kappa}.t1/2​=κln2​.

It does not depend on how large the gap is. With κ=0.5\kappa = 0.5κ=0.5 the half-life is ln⁡2/0.5≈1.39\ln 2 / 0.5 \approx 1.39ln2/0.5≈1.39 years; with κ=5\kappa = 5κ=5 it is about 35 trading days.

Exact solution

The trick is to remove the pull towards θ\thetaθ by a change of variable. Apply Itô's lemma to Yt=f(t,Xt)=eκtXtY_t = f(t, X_t) = e^{\kappa t} X_tYt​=f(t,Xt​)=eκtXt​, with ∂f/∂t=κeκtx\partial f/\partial t = \kappa e^{\kappa t} x∂f/∂t=κeκtx, ∂f/∂x=eκt\partial f/\partial x = e^{\kappa t}∂f/∂x=eκt and ∂2f/∂x2=0\partial^2 f/\partial x^2 = 0∂2f/∂x2=0. Since the second derivative is zero, there is no Itô correction:

dYt=κeκtXt dt+eκt(κ(θ−Xt) dt+σ dWt)=κθ eκt dt+σeκt dWt.dY_t = \kappa e^{\kappa t} X_t\,dt + e^{\kappa t}\big(\kappa(\theta - X_t)\,dt + \sigma\,dW_t\big) = \kappa\theta\,e^{\kappa t}\,dt + \sigma e^{\kappa t}\,dW_t.dYt​=κeκtXt​dt+eκt(κ(θ−Xt​)dt+σdWt​)=κθeκtdt+σeκtdWt​.

The terms with XtX_tXt​ cancel, and the right-hand side no longer depends on YYY. Add up the increments over [0,t][0, t][0,t]:

eκtXt=X0+θ (eκt−1)+σ∫0teκs dWs.e^{\kappa t} X_t = X_0 + \theta\,\big(e^{\kappa t} - 1\big) + \sigma \int_0^t e^{\kappa s}\,dW_s.eκtXt​=X0​+θ(eκt−1)+σ∫0t​eκsdWs​.

Multiplying by e−κte^{-\kappa t}e−κt gives the solution:

Xt=θ+(X0−θ) e−κt+σ∫0te−κ(t−s) dWs.X_t = \theta + (X_0 - \theta)\,e^{-\kappa t} + \sigma \int_0^t e^{-\kappa (t-s)}\,dW_s.Xt​=θ+(X0​−θ)e−κt+σ∫0t​e−κ(t−s)dWs​.

The first two terms are the deterministic path from above. The integral adds up the shocks, each weighted by e−κ(t−s)e^{-\kappa(t-s)}e−κ(t−s): a shock that happened long ago has mostly been pulled back and counts little.

Mean, variance and stationary distribution

The integral of a deterministic function against dWdWdW is normal with mean zero, and by the Itô isometry its variance is the integral of the squared weight: Var⁡(∫0tg(s) dWs)=∫0tg(s)2 ds\operatorname{Var}\big(\int_0^t g(s)\,dW_s\big) = \int_0^t g(s)^2\,dsVar(∫0t​g(s)dWs​)=∫0t​g(s)2ds. With g(s)=σe−κ(t−s)g(s) = \sigma e^{-\kappa(t-s)}g(s)=σe−κ(t−s) this gives

E[Xt]=θ+(X0−θ) e−κt,Var⁡(Xt)=σ22κ(1−e−2κt).\mathbb{E}[X_t] = \theta + (X_0 - \theta)\,e^{-\kappa t}, \qquad \operatorname{Var}(X_t) = \frac{\sigma^2}{2\kappa}\big(1 - e^{-2\kappa t}\big).E[Xt​]=θ+(X0​−θ)e−κt,Var(Xt​)=2κσ2​(1−e−2κt).

So XtX_tXt​ is normally distributed for every ttt. As t→∞t \to \inftyt→∞ the mean tends to θ\thetaθ and the variance stops growing. Compare Brownian motion, whose variance σ2t\sigma^2 tσ2t grows forever.

Stationary distribution of the Ornstein–Uhlenbeck process: X∞∼N(θ, σ2/(2κ))X_\infty \sim N\big(\theta,\ \sigma^2/(2\kappa)\big)X∞​∼N(θ, σ2/(2κ)). Faster mean reversion (larger κ\kappaκ) means a narrower long-run spread around θ\thetaθ.

Exact simulation and the AR(1) form

The same calculation over one step of length Δt\Delta tΔt, started from the current value, gives an exact simulation scheme with no discretisation error. With Z∼N(0,1)Z \sim N(0,1)Z∼N(0,1) drawn independently at each step:

Xt+Δt=θ+(Xt−θ) e−κΔt+σ1−e−2κΔt2κ  Z.X_{t+\Delta t} = \theta + (X_t - \theta)\,e^{-\kappa\Delta t} + \sigma\sqrt{\frac{1 - e^{-2\kappa\Delta t}}{2\kappa}}\;Z.Xt+Δt​=θ+(Xt​−θ)e−κΔt+σ2κ1−e−2κΔt​​Z.

Sampled at a fixed step, the process is a first-order autoregression, AR(1): Xn+1=a+ϕXn+εn+1X_{n+1} = a + \phi X_n + \varepsilon_{n+1}Xn+1​=a+ϕXn​+εn+1​ with ϕ=e−κΔt\phi = e^{-\kappa\Delta t}ϕ=e−κΔt and a=θ(1−ϕ)a = \theta(1 - \phi)a=θ(1−ϕ). Regressing observed values on their previous values therefore estimates the parameters: κ=−ln⁡ϕ/Δt\kappa = -\ln\phi / \Delta tκ=−lnϕ/Δt and θ=a/(1−ϕ)\theta = a/(1-\phi)θ=a/(1−ϕ).

Worked example

Take κ=0.5\kappa = 0.5κ=0.5, θ=4%\theta = 4\%θ=4%, σ=1%\sigma = 1\%σ=1% and a starting level X0=8%X_0 = 8\%X0​=8%, with time in years.

  • Half-life: ln⁡2/0.5≈1.39\ln 2 / 0.5 \approx 1.39ln2/0.5≈1.39 years.
  • After 1 year: mean 4%+4%⋅e−0.5≈6.43%4\% + 4\% \cdot e^{-0.5} \approx 6.43\%4%+4%⋅e−0.5≈6.43%, standard deviation 0.01(1−e−1)/1≈0.80%0.01\sqrt{(1 - e^{-1})/1} \approx 0.80\%0.01(1−e−1)/1​≈0.80%.
  • After 5 years: mean 4%+4%⋅e−2.5≈4.33%4\% + 4\% \cdot e^{-2.5} \approx 4.33\%4%+4%⋅e−2.5≈4.33%, standard deviation ≈0.997%\approx 0.997\%≈0.997%.
  • Stationary standard deviation: σ/2κ=0.01/1=1%\sigma/\sqrt{2\kappa} = 0.01/\sqrt{1} = 1\%σ/2κ​=0.01/1​=1%.

After five years the starting level is almost forgotten: the mean is close to θ\thetaθ and the spread is already 99.7% of its long-run value.

The figure fixes θ=4%\theta = 4\%θ=4% and σ=1%\sigma = 1\%σ=1% over a horizon of 5 years. Sliders set the speed of mean reversion κ\kappaκ (0.1 to 5) and the starting level X0X_0X0​ (0% to 10%), and "New paths" draws fresh paths. The chart shows several simulated paths, the expected path θ+(X0−θ)e−κt\theta + (X_0 - \theta)e^{-\kappa t}θ+(X0​−θ)e−κt and bands at ±2\pm 2±2 standard deviations. The readouts give the half-life, the stationary standard deviation σ/2κ\sigma/\sqrt{2\kappa}σ/2κ​, the expected level after 5 years and the 5-year zero-coupon yield in the Vasicek model with r0=X0r_0 = X_0r0​=X0​. Raise κ\kappaκ and the paths snap to θ\thetaθ while the band narrows; lower it towards 0.1 and the paths look almost like Brownian motion. Then start far from θ\thetaθ, at 0% or 10%, and watch the expected path decay.

Mean-reverting paths (Ornstein–Uhlenbeck)Open in Itô Process →
0.5
0.15
8.00%
010
±2 standard deviationsExpected path
Half-life (years)
1.39
Stationary standard deviation
1.00%
Expected level after 5 years
4.33%
5-year zero-coupon yield (Vasicek)
5.46%

The Vasicek model

The short rate rtr_trt​ is the continuously compounded rate for borrowing over an instant. The Vasicek model assumes that it follows an Ornstein–Uhlenbeck process, drt=κ(θ−rt) dt+σ dWtdr_t = \kappa(\theta - r_t)\,dt + \sigma\,dW_tdrt​=κ(θ−rt​)dt+σdWt​, under the risk-neutral measure Q\mathbb{Q}Q. A zero-coupon bond pays 1 at time TTT, and its price is the expected discount factor along the random path of the short rate, P(0,T)=EQ[e−∫0Trs ds]P(0,T) = \mathbb{E}^{\mathbb{Q}}\big[e^{-\int_0^T r_s\,ds}\big]P(0,T)=EQ[e−∫0T​rs​ds]. Because the integral of a normal process is normal, this expectation has a closed form:

P(0,T)=A(T) e−B(T) r0,B(T)=1−e−κTκ,P(0,T) = A(T)\,e^{-B(T)\,r_0}, \qquad B(T) = \frac{1 - e^{-\kappa T}}{\kappa},P(0,T)=A(T)e−B(T)r0​,B(T)=κ1−e−κT​,
ln⁡A(T)=(θ−σ22κ2)(B(T)−T)−σ2B(T)24κ.\ln A(T) = \left(\theta - \frac{\sigma^2}{2\kappa^2}\right)\big(B(T) - T\big) - \frac{\sigma^2 B(T)^2}{4\kappa}.lnA(T)=(θ−2κ2σ2​)(B(T)−T)−4κσ2B(T)2​.

B(T)B(T)B(T) measures how much the current short rate matters: for short maturities it is close to TTT, while for long maturities it levels off at 1/κ1/\kappa1/κ, because r0r_0r0​ is forgotten. The continuously compounded zero-coupon yield is y(T)=−ln⁡P(0,T)/Ty(T) = -\ln P(0,T)/Ty(T)=−lnP(0,T)/T.

In the example above with r0=8%r_0 = 8\%r0​=8% and T=5T = 5T=5: B(5)=(1−e−2.5)/0.5≈1.836B(5) = (1 - e^{-2.5})/0.5 \approx 1.836B(5)=(1−e−2.5)/0.5≈1.836, A(5)≈0.8815A(5) \approx 0.8815A(5)≈0.8815, so P(0,5)≈0.8815 e−1.836⋅0.08≈0.7611P(0,5) \approx 0.8815\,e^{-1.836 \cdot 0.08} \approx 0.7611P(0,5)≈0.8815e−1.836⋅0.08≈0.7611 and the 5-year yield is −ln⁡(0.7611)/5≈5.46%-\ln(0.7611)/5 \approx 5.46\%−ln(0.7611)/5≈5.46%. The yield lies between r0r_0r0​ and θ\thetaθ, since the market expects the rate to fall back towards 4%.

As TTT grows the yield tends to θ−σ2/(2κ2)\theta - \sigma^2/(2\kappa^2)θ−σ2/(2κ2), here 3.98%3.98\%3.98%. If r0r_0r0​ is below this level the model produces a rising curve, if above an inverted (falling) curve, and for r0r_0r0​ just above it a slightly humped one that rises briefly before falling. The lesson "Spot rates, forward rates and the yield curve" describes these shapes as observed in the market; the Vasicek model can produce only these few, which is why practitioners often fit richer curves directly. The Yield Curve lab shows such market curves.

The main drawback is that a normal short rate can become negative with positive probability. The Cox–Ingersoll–Ross (CIR) model avoids this by making the volatility proportional to rt\sqrt{r_t}rt​​.

Summary

  • The Ornstein–Uhlenbeck process dX=κ(θ−X) dt+σ dWdX = \kappa(\theta - X)\,dt + \sigma\,dWdX=κ(θ−X)dt+σdW is pulled towards the long-run level θ\thetaθ with speed κ\kappaκ; the expected gap halves every ln⁡2/κ\ln 2/\kappaln2/κ.
  • Itô's lemma applied to eκtXte^{\kappa t}X_teκtXt​ gives the exact solution; XtX_tXt​ is normal with mean θ+(X0−θ)e−κt\theta + (X_0 - \theta)e^{-\kappa t}θ+(X0​−θ)e−κt and variance σ22κ(1−e−2κt)\tfrac{\sigma^2}{2\kappa}(1 - e^{-2\kappa t})2κσ2​(1−e−2κt).
  • The variance stays bounded and the stationary distribution is N(θ,σ2/(2κ))N(\theta, \sigma^2/(2\kappa))N(θ,σ2/(2κ)); sampled at a fixed step the process is an AR(1).
  • In the Vasicek model the short rate is an OU process and P(0,T)=A(T)e−B(T)r0P(0,T) = A(T)e^{-B(T)r_0}P(0,T)=A(T)e−B(T)r0​ with B(T)=(1−e−κT)/κB(T) = (1 - e^{-\kappa T})/\kappaB(T)=(1−e−κT)/κ; rates can turn negative.
Try itSimulate Itô processes and compare their drift and spread in the Itô Process lab →
2 questions on this lesson at the end of the series →
← PreviousSimulating SDEs: the Euler–Maruyama schemeNext →Jumps and the Merton jump-diffusion model
Connections
Mean reversion: Ornstein–Uhlenbeck and V…
Open the full graph →
Labs for this lesson
Itô ProcessYield Curve