Ornstein-Uhlenbeck process

by M.A. (Thijs) van den Berg


The Ornstein-Uhlenbeck process is the most widely used mean reverting stochastic process in financial modeling, especially in interest rates and commodities.

Ten scenarios of a the Ornstein-Uhlenbeck process. The scenarios start at S=6 and reverting to a long term mean of 3.
Ten scenarios of a the Ornstein-Uhlenbeck process. The scenarios start at S=6 and reverting to a long term mean of 3.


[edit] Definition

The stochastic differential equation for the Ornstein-Uhlenbeck process is given by

dS_t=\lambda(\mu-S_t)dt+\sigma dW_t \,

with

\lambda \, Mean reversion rate
\mu \, The mean
\sigma \, Volatility

[edit] Long term behavior

Probability bands of the Ornstein-Uhlenbeck, both the expected mean and variance converge to fixed long term value.
Probability bands of the Ornstein-Uhlenbeck, both the expected mean and variance converge to fixed long term value.


The long term mean

\text{E}(S) = \mu\,

Long term variance

\text{VAR}(S) = \frac{\sigma^2}{2\lambda} \,

Long term standard deviation

\text{SD}(S) = \sigma\sqrt{\frac{1}{2\lambda}} \,

Covariance between the price at two moments in time

\text{cov}(t,T) = \frac{\sigma^2}{2\lambda} e^{-\lambda t} e^{-\lambda T} \left[ e^{2\lambda t} - 1 \right] \,

[edit] Simulating the Ornstein-Uhlenbeck process

The Ornstein-Uhlenbeck stochastic process has an exact solution which allows you to simulate with arbitrary time steps.

S(t) = S(0) e^{-\lambda t}+\mu(1-e^{-\lambda t}) + \sigma\sqrt{\frac{1-e^{-2\lambda t}}{2\lambda}} N(0,1) \,

with

S(0) \, The current price.
S(t) \, A random price scenario for the price at some future time t.
N(0,1) \, A random sample from the standard normal distribution.


Alternatively, is value at S(t) \, is normal distributed with:

\begin{align} \text{mean} &= S(0) e^{-\lambda t}+\mu(1-e^{-\lambda t}) \\ \text{sd} &=  \sigma\sqrt{\frac{1-e^{-2\lambda t}}{2\lambda}} \, \end{align}

[edit] Matlab code Example

The following Matlab function return a random Ornstein Uhlenbeck path. The function returns a vector on n+1 elements, the first element being S0.

function S = OU_Simulate(S0, dT, n, mu, sigma, lambda)

    a = exp(-lambda*dT);
    b = mu*(1-a);
    c = sigma*sqrt((1-a*a)/2/lambda);

    S = [S0 filter(1,[1 -a], b+c*randn(1,n), a*S0)];
end

[edit] Simulating Multivariate Ornstein-Uhlenbeck process

The simulation is easily extended to a multivariate case.

\begin{align} S_1(t) &= S_1(0) e^{-\lambda_1 t}+\mu_1(1-e^{-\lambda_1 t}) + \sigma_1\sqrt{\frac{1-e^{-2\lambda_1 t}}{2\lambda_1}} N_1(0,1)\\ S_2(t) &= S_2(0) e^{-\lambda_2 t}+\mu_2(1-e^{-\lambda_2 t}) + \sigma_2\sqrt{\frac{1-e^{-2\lambda_2 t}}{2\lambda_2}} N_2(0,1) \\ S_3(t) &= \dots \end{align}

with

N_1(0,1),N_2(0,1) \, correlated random sample from the standard normal distribution.


You can read more about generating correlated random samples here: Generating Correlated Random Numbers

[edit] Calibrating

Assuming you have a sequence of historical data S0,SΔ,S,..., the calibration the Ornstein-Uhlenbeck model to historical data is done by fitting a linear regression between consecutive values.

S_{t+\Delta} = a S_t + b + \epsilon \,

The model parameters can then be recovered using the following equations.

\begin{align} \lambda &= -\frac{\ln a}{\Delta} \\ \mu &= \frac{b}{1-a}\\ \sigma &= \sigma_\epsilon \sqrt{\frac{-2\ln a}{\Delta(1 - a^2)}} \end{align}

with \sigma_\epsilon \, the standard deviation of the residual of the linear fit.

[edit] Alternative Calibration methods

A more detailed article on calibrating the Ornstein-Uhlenbeck model can be found here

calibrating the Ornstein-Uhlenbeck model »