FxPaul

Math in finance or vice versa

Archive for May 2011

Closed-form solution of modified Ornstein-Uhlenbeck process

with 11 comments

Process definition

In this article we deduce the closed-from solution of the modified version of Ornstein-Uhlenbeck process:
dS = \theta(\mu - S) dt + \sigma S dW_t
where \theta – mean reversion parameter, \mu – mean and \sigma – volatility.

Integrating factor approach

There exists a general approach to non-linear stochastic differential equations of the form:
dX_t = f(t,X_t) dt + c(t) X_t dW_t \, , \, X_0 = x
where f and g are given continuous and deterministic functions.

The method consists of:

  1. Define the integrating factor:
    F_t = F_t(\omega) = \exp\left( - \int_0^t {c(s) dW_s} + \frac{1}{2}\int_0^t {c^2(s) dW_s} \right)
  2. So the original equation could be written as d\left(F_t X_t\right) = F_t f(t,X_t) dt
  3. Now define
    Y_t(\omega) = F_t(\omega) X_t(\omega)
    so that X_t = F^{-1}_t Y_t
  4. And it yields the deterministic differential equation for each \omega\in\Omega
    \frac{dY_t(\omega)}{dt} = F_t(\omega) f\left(t, F^{-1}_t(\omega) Y_t(\omega)\right); \, Y_0 = x

We can therefore solve it with \omega as a parameter to find Y_t(\omega) and then obtain X_t(\omega)

Read the rest of this entry »

Written by fxpaul

May 27, 2011 at 08:39

Posted in trading math

Calibration of Ornstein-Uhlenbeck process

with one comment

Introduction

In mathematics, Ornstein-Uhlenbeck process satisfies the following stochastic differential equation:
dS = \theta(\mu - S) dt + \sigma dW_t
where \theta – mean reversion parameter, \mu – mean and \sigma – volatility.

In finance, it is used to model interest rates, currency exchange rates and commodity prices. Although it is usually modified to incorporate non-negativity of prices.

Ordinary Least-Squares Approach to calibration

The simplest approach to the calibration problem is to convert SDE to finite difference equation (as it is usually used in Monte Carlo simulation) and to rearrange parts to Ordinary Least Squares equation.

The simplest updating formula for Ornstein-Uhlenbeck process is:
S_t - S_{t-1} = \theta (\mu - S_{t-1}) \Delta t + \sigma \sqrt{\Delta t} W_{t-1}
By rearranging we obtain:
S_t - S_{t-1} = \theta\mu\Delta t - \theta S_{t-1}\Delta t +  \sigma \sqrt{\Delta t} W_{t-1}
Comparing with simple regression formula:
y = a + bx + \epsilon
we can equate as follows:
y = S_t - S_{t-1}
x = S_{t-1}
a = \theta\mu\Delta t
b = -\theta\Delta t
\epsilon = \sigma \sqrt{\Delta t} W_{t-1}
and immediately obtain the following:
\theta = -\frac{b}{\Delta t}
\mu    = -\frac{a}{b}

As W_t is drawn from normal distribution, its expectation equals zero and one should use variance to obtain \sigma:
\sigma_{\epsilon} = \sigma \sqrt{\Delta t} \sigma_W
where \sigma_{W} = 1 as it has been already normalized by \sqrt{\Delta t}. Finally, we can obtain:
\sigma = \frac{\sigma_{\epsilon}}{\sqrt{\Delta t}}

So, regression of S_{t-1} against S_t - S_{t-1} gives estimation of process parameters.

The modified process

Let’s consider the process with slight modification and apply the same approach to the modified process:
dS = \theta(\mu - S) dt + \sigma S dW_t
Then the naive updating formula is
S_t - S_{t-1} = \theta (\mu - S_{t-1}) \Delta t + \sigma S_{t-1} \sqrt{\Delta t} W_{t-1}
Then dividing by S_{t-1}:
\frac{S_t}{S_{t-1}} - 1 = \theta\mu\Delta t\frac{1}{S_{t-1}} - \theta \Delta t +  \sigma \sqrt{\Delta t} W_{t-1}
Given simple regression formula:
y = a + bx + \epsilon
we can equate as follows:
y = \frac{S_t}{S_{t-1}} -1
x = \frac{1}{S_{t-1}}
a = - \theta\Delta t
b = \theta\mu\Delta t
\epsilon = \sigma \sqrt{\Delta t} W_{t-1}
and immediately obtain the following:
\theta = - \frac{a}{\Delta t}
\mu    = - \frac{b}{a}
Applying the same logic as in previous section, finally we get:
\sigma = \frac{\sigma_{\epsilon}}{\sqrt{\Delta t}}

Therefore, regression of \frac{S_t}{S_{t-1}} - 1 against \frac{1}{S_{t-1}} yields estimation of modified process parameters.

Open questions

  1. Bias of the estimators. For the original process this approach usually gives quite precise estimation of mean and volatility but fails to provide mean reversion parameter
  2. Closed-form solution of the modified SDE. It could be used to improve the updating formula
  3. Statistical hypothesis testing if the sample drawn from the process. This is quite crucial point as it helps to identify model regime shift in trading.

Written by fxpaul

May 26, 2011 at 11:17

Posted in trading math