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 »


[edit] Comments

Name (required):

Website:

Comment:


[edit] sitmo said ...

We're going to update the calibration process, adding a maximum likelihood estimator.

--sitmo 15:00, 4 June 2007 (CEST)

[edit] gz said ...

If you could describe why calibration was done this way, it would be very interesting...

--gz 15:44, 20 June 2007 (CEST)

[edit] sitmo said ...

The calibration is based on the simulation equation, you'll notice that the regression & the simulation have the same structure...


--sitmo 22:54, 28 June 2007 (CEST)

[edit] goke said ...

brilliant

--goke 21:00, 30 June 2007 (CEST)

[edit] John said ...

Hi! Why not regressing the Increments of S versus the series? (dS=a*S+b) What is the diffenrence between the two approaches?Which one is better? Many thanx

--John 10:26, 5 July 2007 (CEST)

[edit] sitmo said ...

John, dS = aS + b would be S(t+1)- S(t) = a S(t) + b which can be rewritten to S(t+1) = (a+1) S(t) + b

...so they are both the same, except that with your idea you get lambda = - ln(a+1)/ dt the resulting values will however be identical.


--sitmo 10:23, 6 July 2007 (CEST)

[edit] Tuned said ...

How can it be modify for OU process with jumps and OU process with sigma proportional to the sqaure root of lamda (Feller process) without jumps/with jumps. Both cases with non-mean reverting. Thanks

--Tuned 20:16, 19 August 2007 (CEST)

[edit] sitmo said ...

Hi Tuned,

I don't know. You could try the wilmott forums. There are people there like Daniel Duffy who have active discussions about numerical schemes for a wide variety of SDE's (he's working on writing a book on that)

--Admin 22:57, 21 August 2007 (CEST)

[edit] Mary said ...

How do we simulate a multivariate Ornstein Uhlenbeck process?

--Mary 18:42, 12 September 2007 (CEST)

[edit] sitmo said ...

Mary, I've added a (very small) section on multivariate simulation.

--Admin 23:29, 13 September 2007 (CEST)

[edit] Chris said ...

I want to project a time series 2 steps forward. I use your formulae to produce S(1). If I use the same formula with the same parameters for S(2), using t=2, how does this incorporate the information for S(1)? And how is this mean reverting? Thanks.

--Chris 16:43, 31 October 2007 (CET)

[edit] Sitmo said ...

I think what you need is that the second step should start where the first one ended. S(t) = S(0) exp(-l t) ... S(2t) = S(t) exp(-l t) ... S(3t) = S(2t) exp(-l t) ...


--Admin 22:36, 2 November 2007 (CET)

[edit] MAIKL said ...

CONCERNING THE CALIBRATION PROCESS, WHAT IF WE COME UP WITH A NEGATIVE VALUE FOR a? HOW DO WE THEN DERIVE LAMBDA AND SIGMA? MANY THANKS.

--MAIKL 19:05, 28 December 2007 (CET)

[edit] Mat said ...

I also came up with a negative result...

--Mat 21:25, 11 April 2008 (CEST)

[edit] Camilo said ...

where do you found the exact solution...

--Camilo 00:50, 7 May 2008 (CEST)

[edit] gabriel said ...

I want to do a monte-carlo simulation using risk neutral valuation with this stochastic process, what is needed to be modified in the simulation formula?? tks

--gabriel 17:21, 29 May 2008 (CEST)

[edit] Jason said ...

yes, it is what I want to know. Thanks so much

--Jason 07:05, 31 August 2008 (CEST)