SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.stochprocess.MultivariateBrownianMotion Class Reference

This class represents a multivariate Brownian motion process. More...

Inheritance diagram for umontreal.ssj.stochprocess.MultivariateBrownianMotion:
umontreal.ssj.stochprocess.MultivariateStochasticProcess umontreal.ssj.stochprocess.StochasticProcess umontreal.ssj.stochprocess.MultivariateBrownianMotionBridge umontreal.ssj.stochprocess.MultivariateBrownianMotionPCA umontreal.ssj.stochprocess.MultivariateBrownianMotionPCABigSigma

Public Member Functions

 MultivariateBrownianMotion (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, RandomStream stream)
 Constructs a new MultivariateBrownianMotion with parameters.
 MultivariateBrownianMotion (int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, NormalGen gen)
 Constructs a new MultivariateBrownianMotion with parameters.
void nextObservationVector (double[] obs)
 Generates and returns in obs the next observation.
double[] nextObservationVector ()
 Generates and returns the next observation \(\mathbf{X}(t_j)\) of the multivariate stochastic process in a vector created automatically.
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)\).
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.
double[] generatePath ()
 Generates, returns, and saves the sample path.
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)
 Same as generatePath(), but first resets the stream to stream.
void setParams (int c, double x0[], double mu[], double sigma[], double corrZ[][])
 Sets the dimension \(c = \mathtt{c}\), the initial value.
void setParams (double x0[], double mu[], double sigma[])
 Sets the dimension \(c = \mathtt{c}\), the initial value.
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.
double[] getMu ()
 Returns the vector mu.
Public Member Functions inherited from umontreal.ssj.stochprocess.MultivariateStochasticProcess
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.
void setObservationTimes (double[] t, int d)
 Sets the observation times of the process to a copy of t, with.
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.
void getCurrentObservation (double[] obs)
 Returns the value of the last generated observation.
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 umontreal.ssj.stochprocess.StochasticProcess
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)\}\).
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.
double nextObservation ()
 Generates and returns the next observation \(X(t_j)\) of the stochastic process.
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.

Detailed Description

This class represents a multivariate Brownian motion process.

\(\{\mathbf{X}(t) = (X_1(t),…, X_c(t)),  t \geq0 \}\), sampled at times \(0 = t_0 < t_1 < \cdots< t_d\). Each vector coordinate is a univariate Brownian motion \(\{X_i(t),  t \geq0 \}\), with drift and volatility parameters \(\mu_i\) and \(\sigma_i\), so it can be written as

\[ X_i(t_j) - X_i(t_{j-1}) = (t_j - t_{j-1})\mu_i + \sqrt{t_j - t_{j-1}} \sigma_i Z_{j,i} \tag{Brownian-motion-sequential-multi} \]

where \(X_i(0)=0\), each \(Z_{j,i} \sim N(0,1)\), and each \(\mathbf{Z}_j = (Z_{j,1},…,Z_{j,c})\) has correlation matrix \(\mathbf{R}_z\). We write \(\boldsymbol{\mu}= (\mu_1,…,\mu_c)^{\mathsf{t}}\), \(\boldsymbol{\sigma}= (\sigma_1,…,\sigma_c)^{\mathsf{t}}\), and \(\boldsymbol{\Sigma}\) for the covariance matrix of \(\mathbf{X}(1)-\mathbf{X}(0)\), which equals \(\boldsymbol{\Sigma}= \boldsymbol{\sigma}\mathbf{R}_z\boldsymbol{\sigma}^{\mathsf{t}}\) (so the element \((k,l)\) or \(\boldsymbol{\Sigma}\) is the element \((k,l)\) of \(\mathbf{R}_z\) multiplied by \(\sigma_k\sigma_l\)). The trajectories are sampled by the sequential (or random walk) method.

Definition at line 60 of file MultivariateBrownianMotion.java.

Constructor & Destructor Documentation

◆ MultivariateBrownianMotion() [1/2]

umontreal.ssj.stochprocess.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}\). The normal variates \(Z_j\) in are generated by inversion using the umontreal.ssj.rng.RandomStream stream.

Definition at line 86 of file MultivariateBrownianMotion.java.

◆ MultivariateBrownianMotion() [2/2]

umontreal.ssj.stochprocess.MultivariateBrownianMotion.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}\). The normal variates \(Z_j\) in are generated by gen.

Definition at line 101 of file MultivariateBrownianMotion.java.

Member Function Documentation

◆ generatePath() [1/3]

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.generatePath ( )

Generates, returns, and saves the sample path.

\(\{\mathbf{X}(t_0), \mathbf{X}(t_1), …, \mathbf{X}(t_d)\}\), which can then be accessed via getPath, getSubpath, or getObservation. The generation method depends on the process type. If path[] denotes the returned array, then path[cj + i-1] contains \(X_i(t_j)\) for \(j=0,…,d\) and \(i=1,…,c\).

Reimplemented from umontreal.ssj.stochprocess.MultivariateStochasticProcess.

Reimplemented in umontreal.ssj.stochprocess.MultivariateBrownianMotionBridge, umontreal.ssj.stochprocess.MultivariateBrownianMotionPCA, and umontreal.ssj.stochprocess.MultivariateBrownianMotionPCABigSigma.

Definition at line 190 of file MultivariateBrownianMotion.java.

◆ generatePath() [2/3]

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.generatePath ( double[] uniform01)

Same as generatePath() but requires a vector of uniform random numbers which are used to generate the path.

Reimplemented in umontreal.ssj.stochprocess.MultivariateBrownianMotionPCA, and umontreal.ssj.stochprocess.MultivariateBrownianMotionPCABigSigma.

Definition at line 201 of file MultivariateBrownianMotion.java.

◆ generatePath() [3/3]

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.generatePath ( RandomStream stream)

Same as generatePath(), but first resets the stream to stream.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Definition at line 224 of file MultivariateBrownianMotion.java.

◆ getGen()

NormalGen umontreal.ssj.stochprocess.MultivariateBrownianMotion.getGen ( )

Returns the normal random variate generator used.

The RandomStream used for that generator can be changed via getGen().setStream(stream), for example.

Definition at line 305 of file MultivariateBrownianMotion.java.

◆ getMu()

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.getMu ( )

Returns the vector mu.

Definition at line 336 of file MultivariateBrownianMotion.java.

◆ getStream()

RandomStream umontreal.ssj.stochprocess.MultivariateBrownianMotion.getStream ( )

Returns the random stream of the normal generator.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Definition at line 297 of file MultivariateBrownianMotion.java.

◆ nextObservationVector() [1/4]

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.nextObservationVector ( )

Generates and returns the next observation \(\mathbf{X}(t_j)\) of the multivariate stochastic process in a vector created automatically.

The processe is 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\).

Reimplemented in umontreal.ssj.stochprocess.MultivariateBrownianMotionBridge.

Definition at line 136 of file MultivariateBrownianMotion.java.

◆ nextObservationVector() [2/4]

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.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)\).

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 151 of file MultivariateBrownianMotion.java.

◆ nextObservationVector() [3/4]

double[] umontreal.ssj.stochprocess.MultivariateBrownianMotion.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.

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 174 of file MultivariateBrownianMotion.java.

◆ nextObservationVector() [4/4]

void umontreal.ssj.stochprocess.MultivariateBrownianMotion.nextObservationVector ( double[] obs)

Generates and returns in obs the next observation.

\(\mathbf{X}(t_j)\) of the multivariate stochastic process. The processe is 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\).

Reimplemented from umontreal.ssj.stochprocess.MultivariateStochasticProcess.

Reimplemented in umontreal.ssj.stochprocess.MultivariateBrownianMotionBridge.

Definition at line 114 of file MultivariateBrownianMotion.java.

◆ setParams() [1/2]

void umontreal.ssj.stochprocess.MultivariateBrownianMotion.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}\). Warning: This method will recompute some quantities stored internally, which may be slow if called too frequently.

Definition at line 275 of file MultivariateBrownianMotion.java.

◆ setParams() [2/2]

void umontreal.ssj.stochprocess.MultivariateBrownianMotion.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. The vectors x0, mu ans sigma must be of size c as well as the matrix corrZ must be of size c x c. Warning: This method will recompute some quantities stored internally, which may be slow if called too frequently.

Reimplemented in umontreal.ssj.stochprocess.MultivariateBrownianMotionPCA, and umontreal.ssj.stochprocess.MultivariateBrownianMotionPCABigSigma.

Definition at line 240 of file MultivariateBrownianMotion.java.

◆ setStream()

void umontreal.ssj.stochprocess.MultivariateBrownianMotion.setStream ( RandomStream stream)

Resets the random stream of the normal generator to stream.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Definition at line 290 of file MultivariateBrownianMotion.java.


The documentation for this class was generated from the following file: