# Multivariate normal distribution

{{#invoke:Hatnote|hatnote}}Template:Main other
Template:Probability distribution
In probability theory and statistics, the **multivariate normal distribution** or **multivariate Gaussian distribution**, is a generalization of the one-dimensional (univariate) normal distribution to higher dimensions. One possible definition is that a random vector is said to be *k*-variate normally distributed if every linear combination of its *k* components has a univariate normal distribution. Its importance derives mainly from the multivariate central limit theorem. The multivariate normal distribution is often used to describe, at least approximately, any set of (possibly) correlated real-valued random variables each of which clusters around a mean value.

## Notation and parametrization

The multivariate normal distribution of a *k*-dimensional random vector **x** = [*X*_{1}, *X*_{2}, …, *X _{k}*] can be written in the following notation:

or to make it explicitly known that *X* is *k*-dimensional,

with *k*-dimensional mean vector

## Definition

A random vector **x** = (*X*_{1}, …, *X*_{k})' is said to have the multivariate normal distribution if it satisfies the following equivalent conditions.^{[1]}

- Every linear combination of its components
*Y*=*a*_{1}*X*_{1}+ … +*a*is normally distributed. That is, for any constant vector_{k}X_{k}**a**∈**R**^{k}, the random variable*Y*=**a′x**has a univariate normal distribution, where a univariate normal distribution with zero variance is a point mass on its mean.

- There exists a random
*ℓ*-vector**z**, whose components are independent standard normal random variables, a*k*-vector**μ**, and a*k×ℓ*matrix**A**, such that**x**=**Az**+**μ**. Here*ℓ*is the rank of the covariance matrix**Σ**=**AA′**. Especially in the case of full rank, see the section below on Geometric interpretation.

- There is a
*k*-vector**μ**and a symmetric, nonnegative-definite*k×k*matrix**Σ**, such that the characteristic function of**x**is

The covariance matrix is allowed to be singular (in which case the corresponding distribution has no density). This case arises frequently in statistics; for example, in the distribution of the vector of residuals in the ordinary least squares regression. Note also that the *X*_{i} are in general *not* independent; they can be seen as the result of applying the matrix **A** to a collection of independent Gaussian variables **z**.

## Properties

### Density function

#### Non-degenerate case

The multivariate normal distribution is said to be "non-degenerate" when the symmetric covariance matrix is positive definite. In this case the distribution has density^{[2]}

where is the determinant of . Note how the equation above reduces to that of the univariate normal distribution if is a matrix (i.e. a real number).

Each iso-density locus—the locus of points in *k*-dimensional space each of which gives the same particular value of the density—is an ellipse or its higher-dimensional generalization; hence the multivariate normal is a special case of the elliptical distributions.

The descriptive statistic in the non-degenerate multivariate normal distribution equation is known as the square of the Mahalanobis distance, which represents the distance of the test point from the mean . Note that in case when , the distribution reduces to a univariate normal distribution and the Mahalanobis distance reduces to the standard score.

- Bivariate case

In the 2-dimensional nonsingular case (*k* = rank(Σ) = 2), the probability density function of a vector [*X* *Y*]′ is

where *ρ* is the correlation between *X* and *Y* and
where and . In this case,

In the bivariate case, the first equivalent condition for multivariate normality can be made less restrictive: it is sufficient to verify that countably many distinct linear combinations of X and Y are normal in order to conclude that the vector [X Y]′ is bivariate normal.^{[3]}

The bivariate iso-density loci plotted in the *x,y*-plane are ellipses. As the correlation parameter *ρ* increases, these loci appear to be squeezed to the following line :

This is because the above expression - but without the rho being inside a signum function - is the best linear unbiased prediction of *Y* given a value of *X*.^{[4]}

#### Degenerate case

If the covariance matrix is not full rank, then the multivariate normal distribution is degenerate and does not have a density. More precisely, it does not have a density with respect to *k*-dimensional Lebesgue measure (which is the usual measure assumed in calculus-level probability courses). Only random vectors whose distributions are absolutely continuous with respect to a measure are said to have densities (with respect to that measure). To talk about densities but avoid dealing with measure-theoretic complications it can be simpler to restrict attention to a subset of of the coordinates of such that the covariance matrix for this subset is positive definite; then the other coordinates may be thought of as an affine function of the selected coordinates.{{ safesubst:#invoke:Unsubst||date=__DATE__ |$B=
{{#invoke:Category handler|main}}{{#invoke:Category handler|main}}^{[citation needed]}
}}

To talk about densities meaningfully in the singular case, then, we must select a different base measure. Using the disintegration theorem we can define a restriction of Lebesgue measure to the -dimensional affine subspace of where the Gaussian distribution is supported, i.e. . With respect to this measure the distribution has density:

where is the generalized inverse and det* is the pseudo-determinant.^{[5]}

### Higher moments

{{#invoke:main|main}}
The *k*th-order moments of **x** are defined by

where *r*_{1} + *r*_{2} + ⋯ + *r _{N}* =

*k*.

The central *k*-order central moments are given as follows

(a) If *k* is odd, *μ*_{1, …, N}(**x** − **μ**) = 0.

(b) If *k* is even with *k* = 2*λ*, then

where the sum is taken over all allocations of the set into *λ* (unordered) pairs. That is, if you have a *k*th ( = 2*λ* = 6) central moment, you will be summing the products of *λ* = 3 covariances (the -**μ** notation has been dropped in the interests of parsimony):

This yields terms in the sum (15 in the above case), each being the product of *λ* (in this case 3) covariances. For fourth order moments (four variables) there are three terms. For sixth-order moments there are 3 × 5 = 15 terms, and for eighth-order moments there are 3 × 5 × 7 = 105 terms.

The covariances are then determined by replacing the terms of the list by the corresponding terms of the list consisting of *r*_{1} ones, then *r*_{2} twos, etc.. To illustrate this, examine the following 4th-order central moment case:

where is the covariance of *x _{i}* and

*x*. The idea with the above method is you first find the general case for a

_{j}*k*th moment where you have

*k*different

*x*variables - and then you can simplify this accordingly. Say, you have then you simply let

*x*=

_{i}*x*and realise that

_{j}*=*

*σ*

_{i}^{2}.

### Likelihood function

If the mean and variance matrix are unknown, a suitable log likelihood function for a single observation **x** would be:{{ safesubst:#invoke:Unsubst||date=__DATE__ |$B=
{{#invoke:Category handler|main}}{{#invoke:Category handler|main}}^{[citation needed]}
}}

where *x* is a vector of real numbers. The complex case, where *z* is a vector of complex numbers, would be

i.e. with the conjugate transpose (indicated by ) replacing the normal transpose (indicated by ). A similar notation is used for multiple linear regression.^{[6]}

### Entropy

The differential entropy of the multivariate normal distribution is^{[7]}

where the bars denote the matrix determinant.

### Kullback–Leibler divergence

The Kullback–Leibler divergence from to , for non-singular matrices Σ_{0} and Σ_{1}, is:^{[8]}

where is the dimension of the vector space.

The logarithm must be taken to base *e* since the two terms following the logarithm are themselves base-*e* logarithms of expressions that are either factors of the density function or otherwise arise naturally. The equation therefore gives a result measured in nats. Dividing the entire expression above by log_{e} 2 yields the divergence in bits.

### Cumulative distribution function

The notion of cumulative distribution function (cdf) in dimension 1 can be extended in two ways to the multidimensional case.
The first way is to define the cumulative distribution function as the probability that a sample **falls** inside the ellipsoid determined by its Mahalanobis distance from the Gaussian, a direct generalization of the standard deviation
.^{[9]}
In order to compute the values of this function, closed analytic formulae exist.^{[9]}

Another way to extend the notion of cumulative distribution function is to define
the cumulative distribution function (cdf) *F*(**x**_{0}) of a random vector **x** as the probability that all components of **x** are less than or equal to the corresponding values in the vector **x**_{0}. Though there is no closed form for *F*(**x**), there are a number of algorithms that estimate it numerically.^{[10]}

### Prediction Interval

The prediction interval for the multivariate normal distribution yields a region consisting of those vectors **x** satisfying

Here is a -dimensional vector, is the known -dimensional mean vector, is the known covariance matrix and is the quantile function for probability of the chi-squared distribution with degrees of freedom.^{[11]}

When the expression defines the interior of an ellipse and the chi-squared distribution simplifies to an exponential distribution with mean equal to two.

## Joint normality

### Normally distributed and independent

If *X* and *Y* are normally distributed and independent, this implies they are "jointly normally distributed", i.e., the pair (*X*, *Y*) must have multivariate normal distribution. However, a pair of jointly normally distributed variables need not be independent (would only be so if uncorrelated, ).

### Two normally distributed random variables need not be jointly bivariate normal

{{#invoke:see also|seealso}}
The fact that two random variables *X* and *Y* both have a normal distribution does not imply that the pair (*X*, *Y*) has a joint normal distribution. A simple example is one in which X has a normal distribution with expected value 0 and variance 1, and *Y* = *X* if |*X*| > *c* and *Y* = −*X* if |*X*| < *c*, where *c* > 0. There are similar counterexamples for more than two random variables. In general, they sum to a mixture model.

### Correlations and independence

In general, random variables may be uncorrelated but statistically dependent. But if a random vector has a multivariate normal distribution then any two or more of its components that are uncorrelated are independent. This implies that any two or more of its components that are pairwise independent are independent.

But it is **not** true that two random variables that are (separately, marginally) normally distributed and uncorrelated are independent. Two random variables that are normally distributed may fail to be *jointly* normally distributed, i.e., the vector whose components they are may fail to have a multivariate normal distribution. In the preceding example, clearly *X* and *Y* are not independent, yet choosing *c* to be 1.54 makes them uncorrelated.

## Conditional distributions

If **μ** and **Σ** are partitioned as follows

then, the distribution of **x**_{1} conditional on **x**_{2} = *a* is multivariate normal (**x**_{1}|**x**_{2} = **a**) ~ *N*(**μ**, **Σ**) where

and covariance matrix

This matrix is the Schur complement of **Σ**_{22} in **Σ**. This means that to calculate the conditional covariance matrix, one inverts the overall covariance matrix, drops the rows and columns corresponding to the variables being conditioned upon, and then inverts back to get the conditional covariance matrix. Here is the generalized inverse of .

Note that knowing that **x**_{2} = **a** alters the variance, though the new variance does not depend on the specific value of **a**; perhaps more surprisingly, the mean is shifted by ; compare this with the situation of not knowing the value of **a**, in which case **x**_{1} would have distribution
.

An interesting fact derived in order to prove this result, is that the random vectors and are independent.

The matrix **Σ**_{12}**Σ**_{22}^{−1} is known as the matrix of regression coefficients.

### Bivariate case

In the bivariate case where **x** is partitioned into *X*_{1} and *X*_{2}, the conditional distribution of *X*_{1} given *X*_{2} is^{[13]}

where is the correlation coefficient between *X*_{1} and *X*_{2}.

### Bivariate conditional expectation

#### In the general case

The conditional expectation of X_{1} given X_{2} is:

Proof: the result is simply obtained taking the expectation of the conditional distribution above.

#### In the standard normal case

The conditional expectation of X_{1} given X_{2} is:

and the conditional expectation of X_{1} given that X_{2} is smaller/bigger than z is (Maddala 1983, p. 367^{[14]}) :

where the final ratio here is called the inverse Mills ratio.

Proof: the last two results are obtained using the result , so that : and then using the properties of the expectation of a truncated normal distribution.

## Marginal distributions

To obtain the marginal distribution over a subset of multivariate normal random variables, one only needs to drop the irrelevant variables (the variables that one wants to marginalize out) from the mean vector and the covariance matrix. The proof for this follows from the definitions of multivariate normal distributions and linear algebra.^{[15]}

*Example*

Let **x** = [*X*_{1}, *X*_{2}, *X*_{3}] be multivariate normal random variables with mean vector **μ** = [*μ*_{1}, *μ*_{2}, *μ*_{3}] and covariance matrix **Σ** (standard parametrization for multivariate normal distributions). Then the joint distribution of **x′** = [*X*_{1}, *X*_{3}] is multivariate normal with mean vector **μ′** = [*μ*_{1}, *μ*_{3}] and covariance matrix
.

## Affine transformation

If **y** = **c** + **Bx** is an affine transformation of where **c** is an vector of constants and **B** is a constant matrix, then **y** has a multivariate normal distribution with expected value **c** + **Bμ** and variance **BΣB**^{T} i.e., . In particular, any subset of the *x _{i}* has a marginal distribution that is also multivariate normal.
To see this, consider the following example: to extract the subset (

*x*

_{1},

*x*

_{2},

*x*

_{4})

^{T}, use

which extracts the desired elements directly.

Another corollary is that the distribution of **Z** = **b** · **x**, where **b** is a constant vector of the same length as **x** and the dot indicates a vector product, is univariate Gaussian with . This result follows by using

Observe how the positive-definiteness of **Σ** implies that the variance of the dot product must be positive.

An affine transformation of **x** such as 2**x** is not the same as the sum of two independent realisations of **x**.

## Geometric interpretation

The equidensity contours of a non-singular multivariate normal distribution are ellipsoids (i.e. linear transformations of hyperspheres) centered at the mean.^{[16]} Hence the multivariate normal distribution is an example of the class of elliptical distributions. The directions of the principal axes of the ellipsoids are given by the eigenvectors of the covariance matrix **Σ**. The squared relative lengths of the principal axes are given by the corresponding eigenvalues.

If **Σ** = **UΛU**^{T} = **UΛ**^{1/2}(**UΛ**^{1/2})^{T} is an eigendecomposition where the columns of **U** are unit eigenvectors and **Λ** is a diagonal matrix of the eigenvalues, then we have

Moreover, **U** can be chosen to be a rotation matrix, as inverting an axis does not have any effect on *N*(0, **Λ**), but inverting a column changes the sign of **U'**s determinant. The distribution *N*(**μ**, **Σ**) is in effect *N*(0, **I**) scaled by **Λ**^{1/2}, rotated by **U** and translated by **μ**.

Conversely, any choice of **μ**, full rank matrix **U**, and positive diagonal entries Λ_{i} yields a non-singular multivariate normal distribution. If any Λ_{i} is zero and **U** is square, the resulting covariance matrix **UΛU**^{T} is singular. Geometrically this means that every contour ellipsoid is infinitely thin and has zero volume in *n*-dimensional space, as at least one of the principal axes has length of zero.

## Estimation of parameters

The derivation of the maximum-likelihood estimator of the covariance matrix of a multivariate normal distribution is perhaps surprisingly subtle and elegant. See estimation of covariance matrices.

In short, the probability density function (pdf) of a multivariate normal is

and the ML estimator of the covariance matrix from a sample of *n* observations is

which is simply the sample covariance matrix. This is a biased estimator whose expectation is

An unbiased sample covariance is

The Fisher information matrix for estimating the parameters of a multivariate normal distribution has a closed form expression. This can be used, for example, to compute the Cramér–Rao bound for parameter estimation in this setting. See Fisher information for more details.

## Bayesian inference

In Bayesian statistics, the conjugate prior of the mean vector is another multivariate normal distribution, and the conjugate prior of the covariance matrix is an inverse-Wishart distribution . Suppose then that *n* observations have been made

and that a conjugate prior has been assigned, where

where

and

Then,{{ safesubst:#invoke:Unsubst||date=__DATE__ |$B=
{{#invoke:Category handler|main}}{{#invoke:Category handler|main}}^{[citation needed]}
}}

where

## Multivariate normality tests

Multivariate normality tests check a given set of data for similarity to the multivariate normal distribution. The null hypothesis is that the data set is similar to the normal distribution, therefore a sufficiently small *p*-value indicates non-normal data. Multivariate normality tests include the Cox-Small test^{[17]}
and Smith and Jain's adaptation^{[18]} of the Friedman-Rafsky test.^{[19]}

**Mardia's test**^{[20]} is based on multivariate extensions of skewness and kurtosis measures. For a sample {**x**_{1}, ..., **x**_{n}} of *k*-dimensional vectors we compute

Under the null hypothesis of multivariate normality, the statistic *A* will have approximately a chi-squared distribution with Template:Frac2⋅*k*(*k* + 1)(*k* + 2) degrees of freedom, and *B* will be approximately standard normal *N*(0,1).

Mardia's kurtosis statistic is skewed and converges very slowly to the limiting normal distribution. For medium size samples , the parameters of the asymptotic distribution of the kurtosis statistic are modified^{[21]} For small sample tests () empirical critical values are used. Tables of critical values for both statistics are given by Rencher^{[22]} for *k*=2,3,4.

Mardia's tests are affine invariant but not consistent. For example, the multivariate skewness test is not consistent against
symmetric non-normal alternatives.^{[23]}

The **BHEP test**^{[24]} computes the norm of the difference between the empirical characteristic function and the theoretical characteristic function of the normal distribution. Calculation of the norm is performed in the L^{2}(*μ*) space of square-integrable functions with respect to the Gaussian weighting function . The test statistic is

The limiting distribution of this test statistic is a weighted sum of chi-squared random variables,^{[24]} however in practice it is more convenient to compute the sample quantiles using the Monte-Carlo simulations.{{ safesubst:#invoke:Unsubst||date=__DATE__ |$B=
{{#invoke:Category handler|main}}{{#invoke:Category handler|main}}^{[citation needed]}
}}

A detailed survey of these and other test procedures is available.^{[25]}

## Drawing values from the distribution

A widely used method for drawing (sampling) a random vector **x** from the *N*-dimensional multivariate normal distribution with mean vector **μ** and covariance matrix **Σ** works as follows:^{[26]}

- Find any real matrix
**A**such that**A****A**^{T}=**Σ**. When**Σ**is positive-definite, the Cholesky decomposition is typically used, and the extended form of this decomposition can always be used (as the covariance matrix may be only positive semi-definite) in both cases a suitable matrix**A**is obtained. An alternative is to use the matrix**A**=**UΛ**^{½}obtained from a spectral decomposition**Σ**=**UΛU**^{T}of**Σ**. The former approach is more computationally straightforward but the matrices**A**change for different orderings of the elements of the random vector, while the latter approach gives matrices that are related by simple re-orderings. In theory both approaches give equally good ways of determining a suitable matrix**A**, but there are differences in computation time. - Let
**z**= (*z*_{1}, …,*z*)_{N}^{T}be a vector whose components are*N*independent standard normal variates (which can be generated, for example, by using the Box–Muller transform). - Let
**x**be**μ**+**Az**. This has the desired distribution due to the affine transformation property.

## See also

- Chi distribution, the pdf of the 2-norm (or Euclidean norm) of a multivariate normally distributed vector (centered at zero).
- Complex normal distribution, for the generalization to complex valued random variables.
- Copula, for the definition of the Gaussian or normal copula model.
- Multivariate stable distribution extension of the multivariate normal distribution, when the index (exponent in the characteristic function) is between zero to two.
- Mahalanobis distance
- Wishart distribution

## References

- ↑ Gut, Allan (2009)
*An Intermediate Course in Probability*, Springer. ISBN 9781441901613 (Chapter 5) - ↑ UIUC, Lecture 21.
*The Multivariate Normal Distribution*, 21.5:"Finding the Density". - ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ Template:Cite web
- ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}
- ↑ Tong, T. (2010) Multiple Linear Regression : MLE and Its Distributional Results, Lecture Notes
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ J. Duchi, Derivations for Linear Algebra and Optimization [1]. pp. 13
- ↑
^{9.0}^{9.1}Bensimhoun Michael,*N-Dimensional Cumulative Function, And Other Useful Facts About Gaussians and Normal Densities*(2006) - ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}
- ↑ The formal proof for marginal distribution is shown here http://fourier.eng.hmc.edu/e161/lectures/gaussianprocess/node7.html
- ↑ Template:Cite web
- ↑ Template:Cite doi
- ↑ Template:Cite doi
- ↑ Template:Cite doi
- ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ Rencher (1995), pages 112-113.
- ↑ Rencher (1995), pages 493-495.
- ↑ Template:Cite doi
- ↑
^{24.0}^{24.1}{{#invoke:Citation/CS1|citation |CitationClass=journal }} - ↑ {{#invoke:Citation/CS1|citation |CitationClass=journal }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=book }}

### Literature

- {{#invoke:citation/CS1|citation

|CitationClass=book }} Template:Refend

- REDIRECT Template:Probability distributions