SSJ
3.3.1
Stochastic Simulation in Java
|
A multivariate Brownian motion process \(\{\mathbf{X}(t) : t \geq0 \}\) sampled entirely using the principal component decomposition (PCA). More...
Public Member Functions | |
MultivariateBrownianMotionPCABigSigma (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, RandomStream stream) | |
Constructs a new MultivariateBrownianMotionPCABigSigma with parameters \(\boldsymbol{\mu}= \mathtt{mu}\), \(\boldsymbol{\sigma}= \mathtt{sigma}\), correlation matrix \(\mathbf{R}_z = \mathtt{corrZ}\), and initial value \(\mathbf{X}(t_0) = \mathtt{x0}\). More... | |
MultivariateBrownianMotionPCABigSigma (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, NormalGen gen) | |
Constructs a new MultivariateBrownianMotionPCABigSigma with parameters \(\boldsymbol{\mu}= \mathtt{mu}\), \(\boldsymbol{\sigma}= \mathtt{sigma}\), correlation matrix \(\mathbf{R}_z = \mathtt{corrZ}\), and initial value \(\mathbf{X}(t_0) = \mathtt{x0}\). More... | |
void | setParams (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ) |
double [] | generatePath () |
double [] | generatePath (double[] uniform01) |
Public Member Functions inherited from MultivariateBrownianMotion | |
MultivariateBrownianMotion (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, RandomStream stream) | |
Constructs a new MultivariateBrownianMotion with parameters \(\boldsymbol{\mu}= \mathtt{mu}\), \(\boldsymbol{\sigma}= \mathtt{sigma}\), correlation matrix \(\mathbf{R}_z = \mathtt{corrZ}\), and initial value \(\mathbf{X}(t_0) = \mathtt{x0}\). More... | |
MultivariateBrownianMotion (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, NormalGen gen) | |
Constructs a new MultivariateBrownianMotion with parameters \(\boldsymbol{\mu}= \mathtt{mu}\), \(\boldsymbol{\sigma}= \mathtt{sigma}\), correlation matrix \(\mathbf{R}_z = \mathtt{corrZ}\), and initial value \(\mathbf{X}(t_0) = \mathtt{x0}\). More... | |
void | nextObservationVector (double[] obs) |
Generates and returns in obs the next observation \(\mathbf{X}(t_j)\) of the multivariate stochastic process. More... | |
double [] | nextObservationVector () |
Generates and returns the next observation \(\mathbf{X}(t_j)\) of the multivariate stochastic process in a vector created automatically. More... | |
double [] | nextObservationVector (double nextTime, double[] obs) |
Generates and returns the vector of next observations, 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)\). More... | |
double [] | nextObservationVector (double x[], double dt) |
Generates an observation (vector) of the process in dt time units, assuming that the process has (vector) value \(x\) at the current time. More... | |
double [] | generatePath () |
double [] | generatePath (double[] uniform01) |
Same as generatePath() but requires a vector of uniform random numbers which are used to generate the path. | |
double [] | generatePath (RandomStream stream) |
void | setParams (int c, double x0[], double mu[], double sigma[], double corrZ[][]) |
Sets the dimension \(c = \mathtt{c}\), the initial value \(\mathbf{X}(t_0) = \mathtt{x0}\), the average \(\mu= \mathtt{mu}\), the volatility \(\sigma= \mathtt{sigma}\) and the correlation matrix to corrZ . More... | |
void | setParams (double x0[], double mu[], double sigma[]) |
Sets the dimension \(c = \mathtt{c}\), the initial value \(\mathbf{X}(t_0) = \mathtt{x0}\), the average \(\mu= \mathtt{mu}\), the volatility \(\sigma= \mathtt{sigma}\). More... | |
void | setStream (RandomStream stream) |
Resets the random stream of the normal generator to stream . | |
RandomStream | getStream () |
Returns the random stream of the normal generator. | |
NormalGen | getGen () |
Returns the normal random variate generator used. More... | |
double [] | getMu () |
Returns the vector mu . | |
Public Member Functions inherited from MultivariateStochasticProcess | |
abstract double [] | generatePath () |
Generates, returns, and saves the sample path. More... | |
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. More... | |
void | setObservationTimes (double[] t, int d) |
Sets the observation times of the process to a copy of t , with. More... | |
void | getObservation (int j, double[] obs) |
Returns \(\mathbf{X}(t_j)\) in the \(c\)-dimensional vector obs . | |
double | getObservation (int j, int i) |
Returns \(X_i(t_j)\) from the current sample path. | |
abstract void | nextObservationVector (double[] obs) |
Generates and returns in obs the next observation. More... | |
void | getCurrentObservation (double[] obs) |
Returns the value of the last generated observation. More... | |
double [] | getX0 (double[] x0) |
Returns in x0 the initial value \(\mathbf{X}(t_0)\) for this process. | |
int | getDimension () |
Returns the dimension of \(\mathbf{X}\). | |
Public Member Functions inherited from StochasticProcess | |
void | setObservationTimes (double[] T, int d) |
Sets the observation times of the process to a copy of T , with. More... | |
void | setObservationTimes (double delta, int d) |
Sets equidistant observation times at \(t_j = j\delta\), for. More... | |
double [] | getObservationTimes () |
Returns a reference to the array that contains the observation times. More... | |
int | getNumObservationTimes () |
Returns the number \(d\) of observation times, excluding the time \(t_0\). | |
abstract double [] | generatePath () |
Generates, returns, and saves the sample path \(\{X(t_0), X(t_1), \dots, X(t_d)\}\). More... | |
double [] | generatePath (RandomStream stream) |
Same as generatePath() , but first resets the stream to stream . | |
double [] | getPath () |
Returns a reference to the last generated sample path \(\{X(t_0), ... , X(t_d)\}\). More... | |
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. More... | |
double | getObservation (int j) |
Returns \(X(t_j)\) from the current sample path. More... | |
void | resetStartProcess () |
Resets the observation counter to its initial value \(j=0\), so that the current observation \(X(t_j)\) becomes \(X(t_0)\). More... | |
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. More... | |
double | nextObservation () |
Generates and returns the next observation \(X(t_j)\) of the stochastic process. More... | |
int | getCurrentObservationIndex () |
Returns the value of the index \(j\) corresponding to the time. More... | |
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. | |
abstract void | setStream (RandomStream stream) |
Resets the random stream of the underlying generator to stream . | |
abstract RandomStream | getStream () |
Returns the random stream of the underlying generator. | |
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 \(k\)-th observation to be generated for a sample path of this process. More... | |
Protected Member Functions | |
DoubleMatrix2D | decompPCA (DoubleMatrix2D BigSigma) |
void | init () |
Protected Member Functions inherited from MultivariateBrownianMotion | |
void | init () |
void | initCovZCholDecomp () |
void | initCovZ () |
Protected Member Functions inherited from MultivariateStochasticProcess | |
void | init () |
void | createPath () |
Protected Member Functions inherited from StochasticProcess | |
void | init () |
Protected Attributes | |
DoubleMatrix2D | BigSigma |
DoubleMatrix2D | decompPCABigSigma |
DoubleMatrix2D | C |
DoubleMatrix2D | A |
double [] | z |
boolean | decompPCA |
Protected Attributes inherited from MultivariateBrownianMotion | |
NormalGen | gen |
double [] | mu |
double [] | sigma |
double [][] | corrZ |
DoubleMatrix2D | covZ |
DoubleMatrix2D | covZCholDecomp |
CholeskyDecomposition | decomp |
boolean | covZiSCholDecomp |
double [] | dt |
Protected Attributes inherited from MultivariateStochasticProcess | |
double [] | x0 |
int | c = 1 |
Protected Attributes inherited from StochasticProcess | |
boolean | observationTimesSet = false |
double | x0 = 0.0 |
int | d = -1 |
int | observationIndex = 0 |
int | observationCounter = 0 |
double [] | t |
double [] | path |
int [] | observationIndexFromCounter |
Package Attributes | |
double [] | zz |
Package Attributes inherited from MultivariateBrownianMotion | |
double [] | sqrdt |
A multivariate Brownian motion process \(\{\mathbf{X}(t) : t \geq0 \}\) sampled entirely using the principal component decomposition (PCA).
In this class, a matrix which equals the Kronecker products of two matrices C and \(\Sigma\) must be computed. C
is the usual one dimensional Brownian motion covariance matrix and \(\Sigma\) is the matrix that defined the covariance between the one dimensionnal Brownian motion. This Kronecker products is time and memory consuming as it might creates an enormous matrix, matrix that is called BigSigma here. The class MultivariateBrownianMotionPCA provides faster results.
MultivariateBrownianMotionPCABigSigma | ( | int | c, |
double [] | x0, | ||
double [] | mu, | ||
double [] | sigma, | ||
double | corrZ[][], | ||
RandomStream | stream | ||
) |
Constructs a new MultivariateBrownianMotionPCABigSigma
with parameters \(\boldsymbol{\mu}= \mathtt{mu}\), \(\boldsymbol{\sigma}= \mathtt{sigma}\), correlation matrix \(\mathbf{R}_z = \mathtt{corrZ}\), and initial value \(\mathbf{X}(t_0) = \mathtt{x0}\).
The normal variates \(Z_j\) in are generated by inversion using the umontreal.ssj.rng.RandomStream stream
.
MultivariateBrownianMotionPCABigSigma | ( | int | c, |
double [] | x0, | ||
double [] | mu, | ||
double [] | sigma, | ||
double | corrZ[][], | ||
NormalGen | gen | ||
) |
Constructs a new MultivariateBrownianMotionPCABigSigma
with parameters \(\boldsymbol{\mu}= \mathtt{mu}\), \(\boldsymbol{\sigma}= \mathtt{sigma}\), correlation matrix \(\mathbf{R}_z = \mathtt{corrZ}\), and initial value \(\mathbf{X}(t_0) = \mathtt{x0}\).
The normal variates \(Z_j\) in are generated by gen
.