# Monte Carlo simulating Cox-Ingersoll-Ross process

The CIR process is given by the SDE $$\mathrm dr_t = \theta(\mu-r_t)\mathrm dt + \sigma\sqrt{r_t}\mathrm dW_t$$ where $W_t$ is a Brownian motion. I am interested in finite-difference schemes of simulating trajectories of this process, for example I tried the Euler-Maryama scheme $$r_{t+\Delta t} \approx r_t + \theta(\mu - r_t)\Delta t + \sigma\sqrt{r_t}\xi_t\sqrt{\Delta t}, \quad \xi_t\sim\mathscr N(0,1)$$ but when I am making $\Delta t$ smaller and smaller, results do not seem nice. In fact, I am also interested in a more general simulation techniques for similar kind of processes. Any suggestions?

## 1. weighted Milstein Scheme

We assume $\{X_t\}_{t\geq0}$ described by the following stochastic differential equation $$dX_t=\mu(t,X_t)dt+\sigma(t,X_t)dW_t\,\,\,\,\,\,\,\,\,\,\,\,\,(1)$$ Under the Ito version of this scheme Equation $(1)$ becomes $$dX_{t+\Delta t}=X_t+[\alpha\,\mu(t,X_t)+(1-\alpha)\mu(t+\Delta t,X_{t+\Delta t})]\Delta t+\sigma\sqrt{\Delta t \,X_t}\,Z+\frac{1}{2}\sigma(t,X_t)\sigma'(t,X_t)\Delta t(Z^2-1)$$ where $0\leq\alpha\leq1$ is the weight and $Z$ is normal random variable.By application of the Weighted Milstein scheme to the CIR model, $$dr_t=\kappa(\theta-r_t)dt+\sigma\sqrt{r_t}dW_t$$ we have $${{r}_{t+\Delta t}}=\frac{{{r}_{t}}+\kappa (\theta -\alpha\,{{r}_{t}})\Delta t+\sigma \sqrt{{{r}_{t}}}\sqrt{\Delta t}\,{{Z}}+\frac{1}{4}{{\sigma }^{2}}\Delta t({{Z}}^{2}-1)}{1+(1-\alpha )\kappa \,\Delta t}$$

## 2. Balanced Implicit Scheme

This scheme is able to preserve positivity of the variance process. It is defined in Platen and Heath as $${{r}_{t+\Delta t}}=\frac{{{r}_{t}}(1+C(r_t))+\kappa (\theta -{{r}_{t}})\Delta t+\sigma \sqrt{{{r}_{t}}}\sqrt{\Delta t}\,{{Z}}}{1+C(t,r_t)}$$ where $$C(t,r_t)=\kappa dt+\frac{\sigma \sqrt{\Delta t}|Z|}{\sqrt{r_t}}$$

Its convergence is fast,especially for small values of $\sigma$. The discretization scheme is given by $${{r}_{t+\Delta t}}=r_t+(\kappa (\tilde{\theta} -r_t)+\sigma\beta_n\sqrt{r_t}\,)\left(1+\frac{\sigma\beta_n-2\kappa\sqrt{r_t}}{4\sqrt{r_t}}\Delta t\right)\Delta t$$ where $\beta_n=\frac{Z}{\sqrt{\Delta t}}$ and $\tilde{\theta}=\theta-\frac{\sigma^2}{4\kappa}$ This scheme presented in Kahl and Jackel.

There are a lot of methods for simulating such a process, the real problem here is to preserve positivity of the next simulated step as the Gaussian increment might result in negative value and then a non definite value for the next "square-root" step.

An approach that might be suitable to your more general needs is the following where a "consistent-domain" Markov Chain approach is used "Labbé, Remillard, Renaud - A Simple Discretization Scheme for Non negative Diffusion Processes, with Applications to Option Pricing"

There are many other methods to sample from this process, search for "Heston model simulation" and you should find all you need.

Best regards

• Thanks, I'll do that! (Btw, did you leave MSE?) – Ilya May 30 '13 at 14:43
• @Ilya : I'm still "watching" but I only follow the tag "stochastic process" which is my main domain of interest. As there are many experts on the subject on the forum, questions usually get excellent answers even before I can read them which is why you feel like I have disappeared from MSE. Regards – TheBridge May 30 '13 at 15:21
• I understand your point, thx – Ilya May 31 '13 at 12:17
• @Ilya: As I realized that some people missed me on MSE I answered this question ;-) math.stackexchange.com/questions/407332/… regards – TheBridge May 31 '13 at 21:40
• Cool! nice to know you didn't leave it at all :) – Ilya May 31 '13 at 22:50

You can find some implementations in the open-source python Library : https://github.com/AlexandreMoulti/bachelier

Your contributions would be very welcome.