SquareRootDiffusion - Maple Help

Finance

 SquareRootDiffusion
 create new square-root diffusion process

 Calling Sequence SquareRootDiffusion(${X}_{0}$, kappa, theta, sigma, opts)

Parameters

 ${X}_{0}$ - algebraic expression; initial value kappa - algebraic expression; speed of mean reversion theta - algebraic expression; long-term running mean sigma - algebraic expression; volatility opts - (optional) equation(s) of the form option = value where option is scheme; specify options for the SquareRootDiffusion command

Options

 • scheme = unbiased or Euler -- This option specifies which discretization scheme should be used for simulating this process.

Description

 • The SquareRootDiffusion command creates a new square-root diffusion process. This is a process $X\left(t\right)$ governed by the stochastic differential equation (SDE)

$\mathrm{dX}\left(t\right)=\mathrm{\kappa }\left(\mathrm{\theta }\left(t\right)-X\left(t\right)\right)\mathrm{dt}+\mathrm{\sigma }\sqrt{X\left(t\right)}\mathrm{dW}\left(t\right)$

where $\mathrm{\kappa }$ and $\mathrm{\sigma }$ are positive constants and $\mathrm{\theta }\left(t\right)$ is a deterministic function of time such that $0<\mathrm{\theta }\left(t\right)$ for all $0\le t$.

 • This process was proposed by Cox, Ingersoll, and Ross as a model of the short rate, which is often referred to as the CIR model.
 • The parameter ${X}_{0}$ defined the initial value of the underlying stochastic process.
 • The parameter kappa is the speed of mean-reversion. The parameter theta is the long-term running mean. The parameter sigma is the volatility. In general, kappa, theta, and sigma can be any algebraic expressions. However, if the process is to be simulated, these parameters must be assigned numeric values.
 • The scheme option specifies the discretization scheme used for simulation of this process. By default the standard Euler scheme is used. When scheme is set to unbiased the transition density will be used to simulate a value $X\left(t+\mathrm{dt}\right)$ given $X\left(t\right)$.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $r≔\mathrm{SquareRootDiffusion}\left(u,\mathrm{\kappa },\mathrm{\theta },\mathrm{\sigma },t\right)$
 ${r}{≔}{\mathrm{_X0}}$ (1)
 > $\mathrm{Drift}\left(r\left(t\right)\right)$
 ${\mathrm{\kappa }}{}\left({\mathrm{\theta }}{-}{\mathrm{_X0}}{}\left({t}\right)\right)$ (2)
 > $\mathrm{Diffusion}\left(r\left(t\right)\right)$
 ${\mathrm{\sigma }}{}\sqrt{{\mathrm{_X0}}{}\left({t}\right)}$ (3)
 > $\mathrm{Drift}\left(\mathrm{exp}\left(r\left(t\right)\right)\right)$
 ${\mathrm{\kappa }}{}\left({\mathrm{\theta }}{-}{\mathrm{_X0}}{}\left({t}\right)\right){}{{ⅇ}}^{{\mathrm{_X0}}{}\left({t}\right)}{+}\frac{{{\mathrm{\sigma }}}^{{2}}{}{\mathrm{_X0}}{}\left({t}\right){}{{ⅇ}}^{{\mathrm{_X0}}{}\left({t}\right)}}{{2}}$ (4)
 > $\mathrm{Diffusion}\left(\mathrm{exp}\left(r\left(t\right)\right)\right)$
 ${\mathrm{\sigma }}{}\sqrt{{\mathrm{_X0}}{}\left({t}\right)}{}{{ⅇ}}^{{\mathrm{_X0}}{}\left({t}\right)}$ (5)
 > $u≔0.2$
 ${u}{≔}{0.2}$ (6)
 > $\mathrm{\kappa }≔1.0$
 ${\mathrm{\kappa }}{≔}{1.0}$ (7)
 > $\mathrm{\theta }≔0.1$
 ${\mathrm{\theta }}{≔}{0.1}$ (8)
 > $\mathrm{\sigma }≔0.3$
 ${\mathrm{\sigma }}{≔}{0.3}$ (9)
 > $r≔\mathrm{SquareRootDiffusion}\left(u,\mathrm{\kappa },\mathrm{\theta },\mathrm{\sigma }\right)$
 ${r}{≔}{\mathrm{_X1}}$ (10)
 > $\mathrm{PathPlot}\left(r\left(t\right),t=0..3,\mathrm{timesteps}=100,\mathrm{replications}=10,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$

Compare the Euler discretization and the unbiased discretization.

 > $\mathrm{\sigma }≔0.0001$
 ${\mathrm{\sigma }}{≔}{0.0001}$ (11)
 > $\mathrm{r1}≔\mathrm{SquareRootDiffusion}\left(u,\mathrm{\kappa },\mathrm{\theta },\mathrm{\sigma }\right)$
 ${\mathrm{r1}}{≔}{\mathrm{_X2}}$ (12)
 > $\mathrm{r2}≔\mathrm{SquareRootDiffusion}\left(u,\mathrm{\kappa },\mathrm{\theta },\mathrm{\sigma },t,\mathrm{scheme}=\mathrm{unbiased}\right)$
 ${\mathrm{r2}}{≔}{\mathrm{_X3}}$ (13)
 > $\mathrm{r3}≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(x\left(t\right),t\right)=\mathrm{\kappa }\left(\mathrm{\theta }-x\left(t\right)\right),x\left(0\right)=u\right\}\right)$
 ${\mathrm{r3}}{≔}{x}{}\left({t}\right){=}\frac{{1}}{{10}}{+}\frac{{{ⅇ}}^{{-}{t}}}{{10}}$ (14)
 > $\mathrm{P1}≔\mathrm{PathPlot}\left(\mathrm{r1}\left(t\right),t=0..3,\mathrm{timesteps}=5,\mathrm{color}=\mathrm{red}\right)$
 > $\mathrm{P2}≔\mathrm{PathPlot}\left(\mathrm{r2}\left(t\right),t=0..3,\mathrm{timesteps}=5,\mathrm{color}=\mathrm{blue}\right):$
 > $\mathrm{P3}≔\mathrm{plot}\left(\mathrm{rhs}\left(\mathrm{r3}\right),t=0..3,\mathrm{color}=\mathrm{green}\right):$
 > $\mathrm{plots}\left[\mathrm{display}\right]\left(\mathrm{P1},\mathrm{P2},\mathrm{P3},\mathrm{thickness}=3,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$
 > 

References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice. New York: Springer-Verlag, 2001.
 Glasserman, P., Monte Carlo Methods in Financial Engineering. New York: Springer-Verlag, 2004.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.

Compatibility

 • The Finance[SquareRootDiffusion] command was introduced in Maple 15.