Extends RandomMultivariateGen for a multivariate normal (or multinormal) distribution [94] . More...
Public Member Functions | |
| 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. | |
| void | nextPoint (double[] p) |
| Generates a point from this multinormal distribution. | |
| 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. | |
Protected Member Functions | |
| 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)). | |
Extends RandomMultivariateGen for a multivariate normal (or multinormal) distribution [94] .
The \(d\)-dimensional multivariate normal distribution with mean vector
\(\boldsymbol{\mu}\in\mathbb{R}^d\) and (symmetric positive-definite) covariance matrix \(\boldsymbol{\Sigma}\), denoted \(N(\boldsymbol{\mu}, \boldsymbol{\Sigma})\), has density
\[ f(\mathbf{X})=\frac{1}{\sqrt{(2\pi)^d\det(\boldsymbol{\Sigma})}} \exp\left(-(\mathbf{X}- \boldsymbol{\mu})^{\!\mathsf{t}}\boldsymbol{\Sigma}^{-1}(\mathbf{X}- \boldsymbol{\mu})/2\right), \]
for all \(\mathbf{X}\in\mathbb{R}^d\), and \(\mathbf{X}^{\mathsf{t}}\) is the transpose vector of \(\mathbf{X}\). If \(\mathbf{Z}\sim N(\boldsymbol{0}, \mathbf{I})\) where \(\mathbf{I}\) is the identity matrix, \(\mathbf{Z}\) is said to have the standard multinormal distribution.
For the special case \(d=2\), if the random vector \(\mathbf{X}= (X_1, X_2)^{\mathsf{t}}\) has a bivariate normal distribution, then it has mean \(\boldsymbol{\mu}= (\mu_1, \mu_2)^{\mathsf{t}}\), and covariance matrix
\[ \boldsymbol{\Sigma}= \left[\begin{array}{cc} \sigma_1^2 & \rho\sigma_1\sigma_2 \\ \rho\sigma_1\sigma_2 & \sigma_2^2 \end{array}\right] \]
if and only if \(\mathrm{Var}[X_1] = \sigma_1^2\), \(\mathrm{Var}[X_2] = \sigma_2^2\), and the linear correlation between \(X_1\) and \(X_2\) is \(\rho\), where \(\sigma_1 > 0\), \(\sigma_2 > 0\), and \(-1 \le\rho\le1\).
Definition at line 70 of file MultinormalGen.java.
| umontreal.ssj.randvarmulti.MultinormalGen.MultinormalGen | ( | NormalGen | gen1, |
| int | d ) |
Constructs a generator with the standard multinormal distribution (with \(\boldsymbol{\mu}=\boldsymbol{0}\) and.
\(\boldsymbol{\Sigma}= \mathbf{I}\)) in \(d\) dimensions. Each vector \(\mathbf{Z}\) will be generated via \(d\) successive calls to gen1, which must be a standard normal generator.
| gen1 | the one-dimensional generator |
| d | the dimension of the generated vectors |
| IllegalArgumentException | if the one-dimensional normal generator uses a normal distribution with \(\mu\) not equal to 0, or \(\sigma\) not equal to 1. |
| IllegalArgumentException | if `d` is negative. |
| NullPointerException | if `gen1` is `null`. |
Definition at line 120 of file MultinormalGen.java.
|
protected |
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-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 standard normal.
| gen1 | the one-dimensional generator |
| mu | the mean vector. |
| sigma | the covariance matrix. |
| NullPointerException | if any argument is `null`. |
| IllegalArgumentException | if the length of the mean vector is incompatible with the dimensions of the covariance matrix. |
Definition at line 146 of file MultinormalGen.java.
|
protected |
Equivalent to MultinormalGen(gen1, mu, new DenseDoubleMatrix2D (sigma)).
Definition at line 155 of file MultinormalGen.java.
| double[] umontreal.ssj.randvarmulti.MultinormalGen.getMu | ( | ) |
Returns the mean vector used by this generator.
Definition at line 165 of file MultinormalGen.java.
| double umontreal.ssj.randvarmulti.MultinormalGen.getMu | ( | int | i | ) |
Returns the \(i\)-th component of the mean vector for this generator.
| i | the index of the required component. |
| ArrayIndexOutOfBoundsException | if `i` is negative or greater than or equal to getDimension. |
Definition at line 178 of file MultinormalGen.java.
| DoubleMatrix2D umontreal.ssj.randvarmulti.MultinormalGen.getSigma | ( | ) |
Returns the covariance matrix \(\boldsymbol{\Sigma}\) used by this generator.
Definition at line 214 of file MultinormalGen.java.
| void umontreal.ssj.randvarmulti.MultinormalGen.nextPoint | ( | double[] | p | ) |
Generates a point from this multinormal distribution.
| p | the array to be filled with the generated point |
Reimplemented from umontreal.ssj.randvarmulti.RandomMultivariateGen.
Reimplemented in umontreal.ssj.randvarmulti.MultinormalCholeskyGen, and umontreal.ssj.randvarmulti.MultinormalPCAGen.
Definition at line 223 of file MultinormalGen.java.
| void umontreal.ssj.randvarmulti.MultinormalGen.setMu | ( | double[] | mu | ) |
Sets the mean vector to mu.
| mu | the new mean vector. |
| NullPointerException | if `mu` is `null`. |
| IllegalArgumentException | if the length of `mu` does not correspond to getDimension. |
Definition at line 190 of file MultinormalGen.java.
| void umontreal.ssj.randvarmulti.MultinormalGen.setMu | ( | int | i, |
| double | mui ) |
Sets the \(i\)-th component of the mean vector to mui.
| i | the index of the modified component. |
| mui | the new value of \(\mu_i\). |
| ArrayIndexOutOfBoundsException | if `i` is negative or greater than or equal to getDimension. |
Definition at line 204 of file MultinormalGen.java.