simCIR | R Documentation |
This is a function to simulate a Cox-Ingersoll-Ross process given via the SDE
\mathrm{d} X_t = (α-β X_t)\mathrm{d} t + √{γ X_t}\mathrm{d} W_t
with a Brownian motion (W_t)_{t≥q 0} and parameters α,β,γ>0. We use an exact CIR simulator for (X_{t_j} )_{j=1,…,n} through the non-central chi-squares distribution.
simCIR(time.points, n, h, alpha, beta, gamma, equi.dist=FALSE )
alpha, beta, gamma |
numbers given as in the SDE above. |
equi.dist |
a logical value indicating whether the sampling points are equidistant (default |
n |
a number indicating the quantity of sampling points in the case |
h |
a number indicating the step size in the case |
time.points |
a numeric vector of sampling times (necessary if |
A numeric matrix containing the realization of (t_0,X_{t_0}),…, (t_n,X_{t_n}) with t_j denoting the j-th sampling times.
Nicole Hufnagel
Contacts: nicole.hufnagel@math.tu-dortmund.de
S. J. A. Malham and A. Wiese. Chi-square simulation of the CIR process and the Heston model. Int. J. Theor. Appl. Finance, 16(3):1350014, 38, 2013.
## You always need the parameters alpha, beta and gamma ## Additionally e.g. time.points data <- simCIR(alpha=3,beta=1,gamma=1, time.points = c(0,0.1,0.2,0.25,0.3)) ## or n, number of observations, h, distance between observations, ## and equi.dist=TRUE data <- simCIR(alpha=3,beta=1,gamma=1,n=1000,h=0.1,equi.dist=TRUE) plot(data[1,],data[2,], type="l",col=4) ## If you input every value and equi.dist=TRUE, time.points are not ## used for the simulations. data <- simCIR(alpha=3,beta=1,gamma=1,n=1000,h=0.1, time.points = c(0,0.1,0.2,0.25,0.3), equi.dist=TRUE) ## If you leave equi.dist=FALSE, the parameters n and h are not ## used for the simulation. data <- simCIR(alpha=3,beta=1,gamma=1,n=1000,h=0.1, time.points = c(0,0.1,0.2,0.25,0.3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.