SSJ
V. 2.6.

## umontreal.iro.lecuyer.probdistmulti Class MultiNormalDist

```java.lang.Object
umontreal.iro.lecuyer.probdistmulti.ContinuousDistributionMulti
umontreal.iro.lecuyer.probdistmulti.MultiNormalDist
```

`public class MultiNormalDistextends ContinuousDistributionMulti`

Implements the abstract class `ContinuousDistributionMulti` for the multinormal distribution with mean vector μ and covariance matrix Σ. The probability density is

f (x = x1,…, xd) = exp(- (x - μ)TΣ-1(x - μ)/2)/((2π)^d det())1/2

where 1#1 = (x1,…, xd).

Constructor Summary
```MultiNormalDist(double[] mu, double[][] sigma)```

Method Summary
` double` `density(double[] x)`
Returns f (x1, x2,…, xd), the probability density of X evaluated at the point x, where x = {x1, x2,…, xd}.
`static double` ```density(double[] mu, double[][] sigma, double[] x)```
Computes the density of the multinormal distribution with parameters μ = mu and Σ = sigma, evaluated at x.
` double[][]` `getCorrelation()`
Returns the correlation matrix of the distribution, defined as ρij = σij/(σ_iiσ_jj)1/2.
`static double[][]` ```getCorrelation(double[] mu, double[][] sigma)```
Computes the correlation matrix of the multinormal distribution with parameters μ and Σ).
` double[][]` `getCovariance()`
Returns the variance-covariance matrix of the distribution, defined as
σij = E[(Xi - μi)(Xj - μj)].
`static double[][]` ```getCovariance(double[] mu, double[][] sigma)```
Computes the covariance matrix of the multinormal distribution with parameters μ and Σ.
` int` `getDimension()`
Returns the dimension d of the distribution.
` double[]` `getMean()`
Returns the mean vector of the distribution, defined as μi = E[Xi].
`static double[]` ```getMean(double[] mu, double[][] sigma)```
Returns the mean E[X] = μ of the multinormal distribution with parameters μ and Σ.
`static double[]` ```getMLEMu(double[][] x, int n, int d)```
Estimates the parameters μ of the multinormal distribution using the maximum likelihood method.
`static double[][]` ```getMLESigma(double[][] x, int n, int d)```
Estimates the parameters Σ of the multinormal distribution using the maximum likelihood method.
` double[]` `getMu()`
Returns the parameter μ of this object.
` double` `getMu(int i)`
Returns the i-th component of the parameter μ of this object.
` double[][]` `getSigma()`
Returns the parameter Σ of this object.
` void` ```setParams(double[] mu, double[][] sigma)```
Sets the parameters μ and Σ of this object.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MultiNormalDist

```public MultiNormalDist(double[] mu,
double[][] sigma)```
Method Detail

### density

`public double density(double[] x)`
Description copied from class: `ContinuousDistributionMulti`
Returns f (x1, x2,…, xd), the probability density of X evaluated at the point x, where x = {x1, x2,…, xd}. The convention is that x[i - 1] = xi.

Specified by:
`density` in class `ContinuousDistributionMulti`
Parameters:
`x` - value at which the density is evaluated
Returns:
density function evaluated at x

### getMean

`public double[] getMean()`
Description copied from class: `ContinuousDistributionMulti`
Returns the mean vector of the distribution, defined as μi = E[Xi].

Specified by:
`getMean` in class `ContinuousDistributionMulti`

### getCovariance

`public double[][] getCovariance()`
Description copied from class: `ContinuousDistributionMulti`
Returns the variance-covariance matrix of the distribution, defined as
σij = E[(Xi - μi)(Xj - μj)].

Specified by:
`getCovariance` in class `ContinuousDistributionMulti`

### getCorrelation

`public double[][] getCorrelation()`
Description copied from class: `ContinuousDistributionMulti`
Returns the correlation matrix of the distribution, defined as ρij = σij/(σ_iiσ_jj)1/2.

Specified by:
`getCorrelation` in class `ContinuousDistributionMulti`

### density

```public static double density(double[] mu,
double[][] sigma,
double[] x)```
Computes the density of the multinormal distribution with parameters μ = mu and Σ = sigma, evaluated at x.

### getDimension

`public int getDimension()`
Returns the dimension d of the distribution.

Overrides:
`getDimension` in class `ContinuousDistributionMulti`

### getMean

```public static double[] getMean(double[] mu,
double[][] sigma)```
Returns the mean E[X] = μ of the multinormal distribution with parameters μ and Σ.

### getCovariance

```public static double[][] getCovariance(double[] mu,
double[][] sigma)```
Computes the covariance matrix of the multinormal distribution with parameters μ and Σ.

### getCorrelation

```public static double[][] getCorrelation(double[] mu,
double[][] sigma)```
Computes the correlation matrix of the multinormal distribution with parameters μ and Σ).

### getMLEMu

```public static double[] getMLEMu(double[][] x,
int n,
int d)```
Estimates the parameters μ of the multinormal distribution using the maximum likelihood method. It uses the n observations of d components in table x[i][j], i = 0, 1,…, n - 1 and j = 0, 1,…, d - 1.

Parameters:
`x` - the list of observations used to evaluate parameters
`n` - the number of observations used to evaluate parameters
`d` - the dimension of each observation
Returns:
returns the parameters [μ1,...,μd]

### getMLESigma

```public static double[][] getMLESigma(double[][] x,
int n,
int d)```
Estimates the parameters Σ of the multinormal distribution using the maximum likelihood method. It uses the n observations of d components in table x[i][j], i = 0, 1,…, n - 1 and j = 0, 1,…, d - 1.

Parameters:
`x` - the list of observations used to evaluate parameters
`n` - the number of observations used to evaluate parameters
`d` - the dimension of each observation
Returns:
returns the covariance matrix Σ

### getMu

`public double[] getMu()`
Returns the parameter μ of this object.

### getMu

`public double getMu(int i)`
Returns the i-th component of the parameter μ of this object.

### getSigma

`public double[][] getSigma()`
Returns the parameter Σ of this object.

### setParams

```public void setParams(double[] mu,
double[][] sigma)```
Sets the parameters μ and Σ of this object.

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.