# Code for Simulation of SDEs using Girsanov Theorem

http://wilmott.com/i/dominant/block.gif
I have worked with generation of transition probabilities of mean reverting CEV type stochastic differential equations using Girsanov theorem. A variable grid is generated and Transition probabilities are calculated from the well known analytic distribution(CDF) of the CEV noise stochastic differential equation. Various conditional integrals representing noise and variance of the Girsanov exponential are calculated along the grid. The initial CEV transition probabilities are transformed by the conditional values of Girsanov exponential to give the transition probabilities of the CEV type mean reverting stochastic differential equations. These transition probabilities are used by the program to simulate the mean reverting SDE. Many times it will be difficult to numerically solve the problem on such a general grid using the partial differential equation techniques. The method is very general and can be used for precision simulation of other SDEs with more complex dynamics than mean reverting SDEs.

It is natural to use Girsanov on a grid that has no monte carlo like simulation noise that drastically affects the performance of measure related methods in a monte carlo setting.

The paper is not ready yet and will be posted on SSRN in a few days. The experimental code can be downloaded from http://www.infinitiderivatives.com. You have to go to New Technologies page and the link to code can be found at the bottom of the text.

The code only deals with generation of transition probabilities and simulation of the mean reverting SDE but the scope of the paper is wider and will cover other aspects of option pricing so it will take a bit more time.

## Answers and Replies

Thanks for the post! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post?

Greg, I will be posting my paper on SSRN in about a week to ten days. Paper covers several other aspects of stochastic processes so it requires a bit more work. I received a private message from Orodruin about removal of the other 2nd post saying that it was unsubstantiated with a published paper. I did not respond since I did not want to argue even though my paper had more than 1250 downloads on SSRN. That post was also distributing a code that was even more valuable for scientific research community. These codes are meant to contribute to the scientific community working with stochastic processes and are proven to work. If you have any special request about rewording the post, I will certainly like to do that.

For those who downloaded the code, I will try to give some explanation of the code. It simulates the density of mean reverting stochastic differential equations given by the equation
dV(t)=kappa*(theta-V(t)) dt+ epsilon * V(t)^beta * dz(t)
I generate the density of (driftless) noise dY(t)=epsilon * Y(t)^beta * dz(t) analytically using chi-squared density formulas. The drift is added to the noise using Girsanov theorem. Girsanov theorem is a change of measure that adds or removes drift from a stochastic differential equation. In our case the density of V(t) and Y(t) are related by their radon nikodym derivative (Girsanov exponential). I will not go into details of Girsanov which are standard but for the particular SDE, the Girsanov exponential takes the form
Exp[-.5*( (kappa*(theta-V(t)))/(epsilon*V(t)^beta))^2 *dt) + (kappa*(theta-V(t)))/(epsilon*V(t)^beta)) *dz(t)]
For a small time step size as we require for generation of transition probabilities, expected values of these integrals in the exponential can be evaluated with good precision with their approximate variances. Since for small time step size conditional diffusions remains normal, we can use the formula for expected value of lognormal in terms of the mean and variances of the underlying normal to find the conditional value of Girsanov exponetial(radon nikodym derivative) on every point on the Grid and we can retrieve the density of SDE with drift using radon nikodym derivative between two measures and the knowledge of the analytical chi-square density of noise without drift. The method works well and can be used for precision simulation of densities of stochastic differential equations other than just mean reverting SDEs.