This class represents a CIR (Cox, Ingersoll, Ross) process. More...
Public Member Functions | |
| CIRProcess (double x0, double alpha, double b, double sigma, RandomStream stream) | |
| Constructs a new CIRProcess with parameters \(\alpha=
\mathtt{alpha}\), \(b\), \(\sigma= \mathtt{sigma}\) and initial value \(X(t_0) = \mathtt{x0}\). | |
| CIRProcess (double x0, double alpha, double b, double sigma, ChiSquareNoncentralGen gen) | |
| The noncentral chi-square variate generator gen is specified directly instead of specifying the stream. | |
| double | nextObservation () |
| Generates and returns the next observation \(X(t_j)\) of the stochastic process. | |
| double | nextObservation (double nextTime) |
| Generates and returns the next observation at time \(t_{j+1} =
\mathtt{nextTime}\), using the previous observation time \(t_j\) defined earlier (either by this method or by setObservationTimes), as well as the value of the previous observation \(X(t_j)\). | |
| double | nextObservation (double x, double dt) |
| Generates an observation of the process in dt time units, assuming that the process has value \(x\) at the current time. | |
| double[] | generatePath () |
| Generates, returns, and saves the sample path \(\{X(t_0), X(t_1), \dots,
X(t_d)\}\). | |
| double[] | generatePath (RandomStream stream) |
| Generates a sample path of the process at all observation times, which are provided in array t. | |
| void | setParams (double x0, double alpha, double b, double sigma) |
| Resets the parameters \(X(t_0) = \mathtt{x0}\), \(\alpha=
\mathtt{alpha}\), \(b = \mathtt{b}\) and \(\sigma= \mathtt{sigma}\) of the process. | |
| void | setStream (RandomStream stream) |
| Resets the random stream of the noncentral chi-square generator to stream. | |
| RandomStream | getStream () |
| Returns the random stream of the noncentral chi-square generator. | |
| double | getAlpha () |
| Returns the value of \(\alpha\). | |
| double | getB () |
| Returns the value of \(b\). | |
| double | getSigma () |
| Returns the value of \(\sigma\). | |
| ChiSquareNoncentralGen | getGen () |
| Returns the noncentral chi-square random variate generator used. | |
| Public Member Functions inherited from umontreal.ssj.stochprocess.StochasticProcess | |
| void | setObservationTimes (double[] T, int d) |
| Sets the observation times of the process to a copy of T, with. | |
| void | setObservationTimes (double delta, int d) |
| Sets equidistant observation times at \(t_j = j\delta\), for. | |
| double[] | getObservationTimes () |
| Returns a reference to the array that contains the observation times. | |
| int | getNumObservationTimes () |
| Returns the number \(d\) of observation times, excluding the time \(t_0\). | |
| double[] | getPath () |
| Returns a reference to the last generated sample path \(\{X(t_0), ... ,
X(t_d)\}\). | |
| void | getSubpath (double[] subpath, int[] pathIndices) |
| Returns in subpath the values of the process at a subset of the observation times, specified as the times \(t_j\) whose indices. | |
| double | getObservation (int j) |
| Returns \(X(t_j)\) from the current sample path. | |
| void | resetStartProcess () |
| Resets the observation counter to its initial value \(j=0\), so that the current observation \(X(t_j)\) becomes \(X(t_0)\). | |
| boolean | hasNextObservation () |
| Returns true if \(j<d\), where \(j\) is the number of observations of the current sample path generated since the last call to resetStartProcess. | |
| int | getCurrentObservationIndex () |
| Returns the value of the index \(j\) corresponding to the time. | |
| double | getCurrentObservation () |
| Returns the value of the last generated observation \(X(t_j)\). | |
| double | getX0 () |
| Returns the initial value \(X(t_0)\) for this process. | |
| void | setX0 (double s0) |
| Sets the initial value \(X(t_0)\) for this process to s0, and reinitializes. | |
| int[] | getArrayMappingCounterToIndex () |
| Returns a reference to an array that maps an integer \(k\) to \(i_k\), the index of the observation \(S(t_{i_k})\) corresponding to the. | |
This class represents a CIR (Cox, Ingersoll, Ross) process.
[35] \(\{X(t) : t \geq0 \}\), sampled at times \(0 = t_0 < t_1 < \cdots< t_d\). This process obeys the stochastic differential equation
\[ dX(t) = \alpha(b - X(t)) dt + \sigma\sqrt{X(t)} dB(t) \tag{cir} \]
with initial condition \(X(0)= x_0\), where \(\alpha\), \(b\) and \(\sigma\) are positive constants, and \(\{B(t), t\ge0\}\) is a standard Brownian motion (with drift 0 and volatility 1). This process is mean-reverting in the sense that it always tends to drift toward its general mean \(b\). The process is generated using the sequential technique [67] (p. 122)
\[ X(t_j) = \frac{\sigma^2\left(1 - e^{-\alpha(t_j - t_{j-1})}\right)}{4\alpha} \chi^{\prime 2}_{\nu}\left(\frac{4\alpha e^{-\alpha(t_j - t_{j-1}) } X(t_{j-1})}{\sigma^2\left(1 - e^{-\alpha(t_j - t_{j-1})}\right)}\right), \tag{cir-seq} \]
where \(\nu= 4b\alpha/\sigma^2\), and \(\chi^{\prime 2}_{\nu}(\lambda)\) is a noncentral chi-square random variable with \(\nu\) degrees of freedom and noncentrality parameter \(\lambda\).
<div class="SSJ-bigskip"></div><div class="SSJ-bigskip"></div>
Definition at line 56 of file CIRProcess.java.
| umontreal.ssj.stochprocess.CIRProcess.CIRProcess | ( | double | x0, |
| double | alpha, | ||
| double | b, | ||
| double | sigma, | ||
| RandomStream | stream ) |
Constructs a new CIRProcess with parameters \(\alpha= \mathtt{alpha}\), \(b\), \(\sigma= \mathtt{sigma}\) and initial value \(X(t_0) = \mathtt{x0}\).
The noncentral chi-square variates \(\chi^{\prime2}_{\nu}(\lambda)\) will be generated by inversion using the stream stream.
Definition at line 70 of file CIRProcess.java.
| umontreal.ssj.stochprocess.CIRProcess.CIRProcess | ( | double | x0, |
| double | alpha, | ||
| double | b, | ||
| double | sigma, | ||
| ChiSquareNoncentralGen | gen ) |
The noncentral chi-square variate generator gen is specified directly instead of specifying the stream.
gen can use a method other than inversion.
Definition at line 79 of file CIRProcess.java.
| double[] umontreal.ssj.stochprocess.CIRProcess.generatePath | ( | ) |
Generates, returns, and saves the sample path \(\{X(t_0), X(t_1), \dots, X(t_d)\}\).
It can then be accessed via getPath, getSubpath, or getObservation. The generation method depends on the process type.
Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.
Definition at line 142 of file CIRProcess.java.
| double[] umontreal.ssj.stochprocess.CIRProcess.generatePath | ( | RandomStream | stream | ) |
Generates a sample path of the process at all observation times, which are provided in array t.
Note that t[0] should be the observation time of x0, the initial value of the process, and t[] should have at least
\(d+1\) elements (see the setObservationTimes method).
Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.
Definition at line 183 of file CIRProcess.java.
| double umontreal.ssj.stochprocess.CIRProcess.getAlpha | ( | ) |
Returns the value of \(\alpha\).
Definition at line 221 of file CIRProcess.java.
| double umontreal.ssj.stochprocess.CIRProcess.getB | ( | ) |
Returns the value of \(b\).
Definition at line 228 of file CIRProcess.java.
| ChiSquareNoncentralGen umontreal.ssj.stochprocess.CIRProcess.getGen | ( | ) |
Returns the noncentral chi-square random variate generator used.
The RandomStream used for that generator can be changed via getGen().setStream(stream), for example.
Definition at line 244 of file CIRProcess.java.
| double umontreal.ssj.stochprocess.CIRProcess.getSigma | ( | ) |
Returns the value of \(\sigma\).
Definition at line 235 of file CIRProcess.java.
| RandomStream umontreal.ssj.stochprocess.CIRProcess.getStream | ( | ) |
Returns the random stream of the noncentral chi-square generator.
Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.
Definition at line 214 of file CIRProcess.java.
| double umontreal.ssj.stochprocess.CIRProcess.nextObservation | ( | ) |
Generates and returns the next observation \(X(t_j)\) of the stochastic process.
The processes are usually sampled sequentially, i.e. if the last observation generated was for time
\(t_{j-1}\), the next observation returned will be for time \(t_j\). In some cases, subclasses extending this abstract class may use non-sequential sampling algorithms (such as bridge sampling). The order of generation of the \(t_j\)’s is then specified by the subclass. All the processes generated using principal components analysis (PCA) do not have this method.
Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.
Definition at line 89 of file CIRProcess.java.
| double umontreal.ssj.stochprocess.CIRProcess.nextObservation | ( | double | nextTime | ) |
Generates and returns the next observation at time \(t_{j+1} = \mathtt{nextTime}\), using the previous observation time \(t_j\) defined earlier (either by this method or by setObservationTimes), as well as the value of the previous observation \(X(t_j)\).
Warning: This method will reset the observations time \(t_{j+1}\) for this process to nextTime. The user must make sure that the \(t_{j+1}\) supplied is \(\geq t_j\).
Definition at line 113 of file CIRProcess.java.
| double umontreal.ssj.stochprocess.CIRProcess.nextObservation | ( | double | x, |
| double | dt ) |
Generates an observation of the process in dt time units, assuming that the process has value \(x\) at the current time.
Uses the process parameters specified in the constructor. Note that this method does not affect the sample path of the process stored internally (if any).
Definition at line 130 of file CIRProcess.java.
| void umontreal.ssj.stochprocess.CIRProcess.setParams | ( | double | x0, |
| double | alpha, | ||
| double | b, | ||
| double | sigma ) |
Resets the parameters \(X(t_0) = \mathtt{x0}\), \(\alpha= \mathtt{alpha}\), \(b = \mathtt{b}\) and \(\sigma= \mathtt{sigma}\) of the process.
Warning: This method will recompute some quantities stored internally, which may be slow if called too frequently.
Definition at line 194 of file CIRProcess.java.
| void umontreal.ssj.stochprocess.CIRProcess.setStream | ( | RandomStream | stream | ) |
Resets the random stream of the noncentral chi-square generator to stream.
Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.
Definition at line 207 of file CIRProcess.java.