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

Extends MultinormalGen for a multivariate normal distribution. More...

Inheritance diagram for umontreal.ssj.randvarmulti.MultinormalPCAGen:
umontreal.ssj.randvarmulti.MultinormalGen umontreal.ssj.randvarmulti.RandomMultivariateGen

Public Member Functions

 MultinormalPCAGen (NormalGen gen1, double[] mu, double[][] sigma)
 Equivalent to MultinormalPCAGen(gen1, mu, new DenseDoubleMatrix2D(sigma)).
 MultinormalPCAGen (NormalGen gen1, double[] mu, DoubleMatrix2D sigma)
 Constructs a multinormal generator with mean vector mu and covariance matrix sigma.
DoubleMatrix2D getPCADecompSigma ()
 Returns the matrix \(\mathbf{A}= \mathbf{V}\sqrt{\boldsymbol{\Lambda}}\) of this object.
double[] getLambda ()
 Returns the eigenvalues of \(\boldsymbol{\Sigma}\) in decreasing order.
void setSigma (DoubleMatrix2D sigma)
 Sets the covariance matrix \(\boldsymbol{\Sigma}\) of this multinormal generator to sigma (and recomputes \(\mathbf{A}\)).
void nextPoint (double[] p)
 Generates a point from this multinormal distribution.
Public Member Functions inherited from umontreal.ssj.randvarmulti.MultinormalGen
 MultinormalGen (NormalGen gen1, int d)
 Constructs a generator with the standard multinormal distribution (with \(\boldsymbol{\mu}=\boldsymbol{0}\) and.
double[] getMu ()
 Returns the mean vector used by this generator.
double getMu (int i)
 Returns the \(i\)-th component of the mean vector for this generator.
void setMu (double[] mu)
 Sets the mean vector to mu.
void setMu (int i, double mui)
 Sets the \(i\)-th component of the mean vector to mui.
DoubleMatrix2D getSigma ()
 Returns the covariance matrix \(\boldsymbol{\Sigma}\) used by this generator.
Public Member Functions inherited from umontreal.ssj.randvarmulti.RandomMultivariateGen
void nextArrayOfPoints (double[][] v, int start, int n)
 Generates \(n\) random points.
int getDimension ()
 Returns the dimension of this multivariate generator (the dimension of the random points).
RandomStream getStream ()
 Returns the umontreal.ssj.rng.RandomStream used by this object.
void setStream (RandomStream stream)
 Sets the umontreal.ssj.rng.RandomStream used by this object to stream.

Static Public Member Functions

static DoubleMatrix2D decompPCA (double[][] sigma)
 Computes the decomposition sigma = \(\boldsymbol{\Sigma}= \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{\mathsf{t}}\).
static DoubleMatrix2D decompPCA (DoubleMatrix2D sigma)
 Computes the decomposition sigma = \(\boldsymbol{\Sigma}= \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{\mathsf{t}}\).
static double[] getLambda (DoubleMatrix2D sigma)
 Computes and returns the eigenvalues of sigma in decreasing order.
static void nextPoint (NormalGen gen1, double[] mu, DoubleMatrix2D sigma, double[] p)
 Generates a \(d\)-dimensional vector from the multinormal distribution with mean vector mu and covariance matrix sigma, using the one-dimensional normal generator gen1 to generate the coordinates of \(\mathbf{Z}\), and using the PCA decomposition of.
static void nextPoint (NormalGen gen1, double[] mu, double[][] sigma, double[] p)
 Equivalent to nextPoint(gen1, mu, new DenseDoubleMatrix2D(sigma), p).

Additional Inherited Members

Protected Member Functions inherited from umontreal.ssj.randvarmulti.MultinormalGen
 MultinormalGen (NormalGen gen1, double[] mu, DoubleMatrix2D sigma)
 Constructs a multinormal generator with mean vector mu and covariance matrix sigma.
 MultinormalGen (NormalGen gen1, double[] mu, double[][] sigma)
 Equivalent to MultinormalGen(gen1, mu, new DenseDoubleMatrix2D (sigma)).

Detailed Description

Extends MultinormalGen for a multivariate normal distribution.

[94] , generated via the method of principal components analysis (PCA) of the covariance matrix. The covariance matrix \(\boldsymbol{\Sigma}\) is decomposed (by the constructor) as \(\boldsymbol{\Sigma}= \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{\mathsf{t}}\) where \(\mathbf{V}\) is an orthogonal matrix and \(\boldsymbol{\Lambda}\) is the diagonal matrix made up of the eigenvalues of \(\boldsymbol{\Sigma}\). \(\mathbf{V}^{\mathsf{t}}\) is the transpose matrix of \(\mathbf{V}\). The eigenvalues are ordered from the largest ( \(\lambda_1\)) to the smallest ( \(\lambda_d\)). The random multinormal vector \(\mathbf{X}\) is generated via

\[ \mathbf{X}= \boldsymbol{\mu}+ \mathbf{A}\mathbf{Z}, \]

where \(\mathbf{A}= \mathbf{V}\sqrt{\boldsymbol{\Lambda}}\), and \(\mathbf{Z}\) is a \(d\)-dimensional vector of independent standard normal random variates. The decomposition method uses the SingularValueDecomposition class in colt.

Definition at line 58 of file MultinormalPCAGen.java.

Constructor & Destructor Documentation

◆ MultinormalPCAGen() [1/2]

umontreal.ssj.randvarmulti.MultinormalPCAGen.MultinormalPCAGen ( NormalGen gen1,
double[] mu,
double sigma[][] )

◆ MultinormalPCAGen() [2/2]

umontreal.ssj.randvarmulti.MultinormalPCAGen.MultinormalPCAGen ( NormalGen gen1,
double[] mu,
DoubleMatrix2D sigma )

Constructs a multinormal generator with mean vector mu and covariance matrix sigma.

The mean vector must have the same length as the dimensions of the covariance matrix, which must be symmetric and positive semi-definite. If any of the above conditions is violated, an exception is thrown. The vector \(\mathbf{Z}\) is generated by calling \(d\) times the generator gen1, which must be a standard normal 1-dimensional generator.

Parameters
gen1the one-dimensional generator
muthe mean vector.
sigmathe covariance matrix.
Exceptions
NullPointerExceptionif any argument is `null`.
IllegalArgumentExceptionif the length of the mean vector is incompatible with the dimensions of the covariance matrix.

Definition at line 108 of file MultinormalPCAGen.java.

Member Function Documentation

◆ decompPCA() [1/2]

DoubleMatrix2D umontreal.ssj.randvarmulti.MultinormalPCAGen.decompPCA ( double sigma[][])
static

Computes the decomposition sigma = \(\boldsymbol{\Sigma}= \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{\mathsf{t}}\).

Returns

\(\mathbf{A}= \mathbf{V}\sqrt{\boldsymbol{\Lambda}}\).

Definition at line 119 of file MultinormalPCAGen.java.

◆ decompPCA() [2/2]

DoubleMatrix2D umontreal.ssj.randvarmulti.MultinormalPCAGen.decompPCA ( DoubleMatrix2D sigma)
static

Computes the decomposition sigma = \(\boldsymbol{\Sigma}= \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{\mathsf{t}}\).

Returns

\(\mathbf{A}= \mathbf{V}\sqrt{\boldsymbol{\Lambda}}\).

Definition at line 129 of file MultinormalPCAGen.java.

◆ getLambda() [1/2]

double[] umontreal.ssj.randvarmulti.MultinormalPCAGen.getLambda ( )

Returns the eigenvalues of \(\boldsymbol{\Sigma}\) in decreasing order.

Definition at line 170 of file MultinormalPCAGen.java.

◆ getLambda() [2/2]

double[] umontreal.ssj.randvarmulti.MultinormalPCAGen.getLambda ( DoubleMatrix2D sigma)
static

Computes and returns the eigenvalues of sigma in decreasing order.

Definition at line 158 of file MultinormalPCAGen.java.

◆ getPCADecompSigma()

DoubleMatrix2D umontreal.ssj.randvarmulti.MultinormalPCAGen.getPCADecompSigma ( )

Returns the matrix \(\mathbf{A}= \mathbf{V}\sqrt{\boldsymbol{\Lambda}}\) of this object.

Returns
the PCA square root of the covariance matrix

Definition at line 151 of file MultinormalPCAGen.java.

◆ nextPoint() [1/3]

void umontreal.ssj.randvarmulti.MultinormalPCAGen.nextPoint ( double[] p)

Generates a point from this multinormal distribution.

This is much faster than the static method as it computes the singular value decomposition matrix only once in the constructor.

Parameters
pthe array to be filled with the generated point

Reimplemented from umontreal.ssj.randvarmulti.MultinormalGen.

Definition at line 257 of file MultinormalPCAGen.java.

◆ nextPoint() [2/3]

void umontreal.ssj.randvarmulti.MultinormalPCAGen.nextPoint ( NormalGen gen1,
double[] mu,
double sigma[][],
double[] p )
static

◆ nextPoint() [3/3]

void umontreal.ssj.randvarmulti.MultinormalPCAGen.nextPoint ( NormalGen gen1,
double[] mu,
DoubleMatrix2D sigma,
double[] p )
static

Generates a \(d\)-dimensional vector from the multinormal distribution with mean vector mu and covariance matrix sigma, using the one-dimensional normal generator gen1 to generate the coordinates of \(\mathbf{Z}\), and using the PCA decomposition of.

\(\boldsymbol{\Sigma}\). The resulting vector is put into p. Note that this static method will be very slow for large dimensions, because it recomputes the singular value decomposition at every call. It is therefore recommended to use a MultinormalPCAGen object instead, if the method is to be called more than once.

Parameters
pthe array to be filled with the generated point.
Exceptions
IllegalArgumentExceptionif the one-dimensional normal generator uses a normal distribution with \(\mu\) not equal to 0, or \(\sigma\) not equal to 1.
IllegalArgumentExceptionif the length of the mean vector is different from the dimensions of the covariance matrix, or if the covariance matrix is not symmetric and positive-definite.
NullPointerExceptionif any argument is `null`.

Definition at line 213 of file MultinormalPCAGen.java.

◆ setSigma()

void umontreal.ssj.randvarmulti.MultinormalPCAGen.setSigma ( DoubleMatrix2D sigma)

Sets the covariance matrix \(\boldsymbol{\Sigma}\) of this multinormal generator to sigma (and recomputes \(\mathbf{A}\)).

Parameters
sigmathe new covariance matrix.
Exceptions
IllegalArgumentExceptionif `sigma` has incorrect dimensions.

Definition at line 181 of file MultinormalPCAGen.java.


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