# 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.

# Discretisation schemes

If you want to simulate the path, then common practice is to sample from the exact distribution, as for the CIR process this is known. The distribution can be found from the original CIR paper (1985). However, this requires sampling from a non-central $$\chi^2$$-distribution, which can be very expensive, and a bit more difficult to implement than a an Euler-Maruyama scheme.

For the Euler-Mayuama scheme, or variants thereof which are appropriate for the CIR process, some popular choices in the academic/scientific setting include

• The truncated scheme by Deelstra and Delbaen.
• The fully truncated scheme by Lord et al.
• The reflected scheme by Berkaoui et al.
• The reflected scheme by Higham et al.
• Higher order schemes by Alfonsi.
• etc.

For some more discussion on these see Dereich et al. and Lord et al. Of course most people in finance are quiet about what they use, so it's only possible to comment on how popular these are in a scientific setting.

It is worth noting that while the Euler-Maruyama scheme is much cheaper compared the exact CIR simulation (using non-central $$\chi^2$$ samples), it is very biased, and thus can require some very fine path simulations, which can eat into some of the saving.

# References

• John C. Cox, Jonathan E. Ingersoll Jr, and Stephen A. Ross. A theory of the term structure of interest rates. Econometrica, 53(2):385–408–164, March 1985.
• Aurélien Alfonsi. On the discretization schemes for the CIR (and Bessel squared) processes. Monte Carlo Methods and Applications, 11(4):355–384, 2005. (cf. the 2008 and 2010 papers also).
• Griselda Deelstra and Freddy Delbaen. Convergence of discretized stochastic (interest rate) processes with stochastic drift term. Applied stochastic models and data analysis, 14(1):77–84, 1998.
• Steffen Dereich, Andreas Neuenkirch, and Lukasz Szpruch. An Euler-type method for the strong approximation of the Cox-Ingersoll-Ross process. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences, 468(2140):1105–1115, 2012.
• Abdel Berkaoui, Mireille Bossy, and Awa Diop. Euler scheme for SDEs with non-Lipschitz diffusion coefficient: strong convergence. ESAIM: Probability and Statistics, 12:1–11, 2008.
• Desmond J Higham, Xuerong Mao, and Andrew M Stuart. Strong convergence of Euler-type methods for nonlinear stochastic differential equations. SIAM Journal on Numerical Analysis, 40 (3):1041–1063, 2002.
• Roger Lord, Remmert Koekkoek, and Dick van Dijk. A comparison of biased simulation schemes for stochastic volatility models. Quantitative Finance, 10(2):177–194, 2010.