Multivariate normal distribution

From Wikipedia Mirror

Jump to: navigation, search

Template:Probability distribution</math>
<math>

                \exp\left( -\frac{1}{2}( x - \mu)^\top \Sigma^{-1} (x - \mu)\right)</math>|
 cdf        =No analytic expression|
 mean       =<math>\mu</math>|
 median     =<math>\mu</math>|
 mode       =<math>\mu</math>|
 variance   =<math>\Sigma</math> (covariance matrix)|
 skewness   =0|
 kurtosis   =0|
 entropy    =<math>\ln\left(\sqrt{(2\,\pi\,e)^N \left| \Sigma \right|}\right)\!</math>|
 mgf        =<math>M_X(t)= \exp\left( \mu^\top t + \frac{1}{2} t^\top \Sigma t\right)</math>|
 char       =<math>\phi_X(t;\mu,\Sigma)=\exp\left( i \mu^\top t - \frac{1}{2} t^\top \Sigma t\right)</math>|

}}

File:GaussianScatterPCA.png
multivariate Gaussian distribution centered at (1,3) with a standard deviation of 3 in roughly the (0.878, 0.478) direction and of 1 in the orthogonal direction.
MVN redirects here. For the airport with that IATA code in Mount Vernon, Illinois, see Mount Vernon Airport.

In probability theory and statistics, a multivariate normal distribution, sometimes also called a multivariate Gaussian distribution, is a generalization of the one-dimensional normal distribution (also called a Gaussian distribution) to higher dimensions. It is also closely related to matrix normal distribution.

Contents

General case

A random vector <math>\ X = [X_1, \dots, X_N]^T</math> follows a multivariate normal distribution if it satisfies the following equivalent conditions:

  • there is a random vector <math>\ Z = [Z_1, \dots, Z_M]^T</math>, whose components are independent standard normal random variables, a vector <math>\ \mu = [\mu_1, \dots, \mu_N]^T</math> and an <math>N \times M</math> matrix <math>\ A</math> such that <math>\ X = A Z + \mu</math>.
  • there is a vector <math>\mu</math> and a symmetric, positive semi-definite matrix <math>\ \Sigma</math> such that the characteristic function of X is
<math>

\phi_X\left(u;\mu,\Sigma\right) = \exp\left( i \mu^\top u - \frac{1}{2} u^\top \Sigma u \right). </math>

If <math>\ \Sigma</math> is non-singular, then the distribution may be described by the following PDF:

<math>

f_X(x_1, \dots, x_N) = \frac{1}{ (2\pi)^{N/2}|\Sigma|^{1/2} } \exp\left( -\frac{1}{2} [x - \mu]^\top \Sigma^{-1} [x - \mu] \right) </math>

where <math>\ \left| \Sigma \right|</math> is the determinant of <math>\ \Sigma</math>. Note how the equation above reduces to that of the univariate normal distribution if <math>\ \Sigma</math> is a scalar (i.e., a 1×1 matrix).

The vector μ in these conditions is the expected value of X and the matrix <math>\ \Sigma = A A^T</math> is the covariance matrix of the components Xi. (If, as in MATLAB, each column of <math>\ A </math> represents a variable with the observations along that column, the covariance matrix would be <math>\ \Sigma = A^T A</math>.)

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 ordinary linear regression problems. Note also that the Xi 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.

That the distribution of a random vector X is a multivariate normal distribution can be written in the following notation:

<math>X\ \sim \mathcal{N}(\mu, \Sigma),</math>

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

<math>X\ \sim \mathcal{N}_N(\mu, \Sigma).</math>

Cumulative distribution function

The cumulative distribution function (cdf) <math>F(x)</math> is defined as the probability that all values in a random vector <math>X</math> are less than or equal to the corresponding values in vector <math>x</math>. Though there is no closed form for <math>F(x)</math>, there are a number of algorithms that estimate it numerically. For example, see MVNDST under [1] (includes FORTRAN code) or [2] (includes MATLAB code).

A counterexample

Template:See also The fact that two random variables X and Y both have a normal distribution does not imply that the pair (XY) has a joint normal distribution. A simple example is one in which Y = X if |X| > 1 and Y = −X if |X| < 1. This is also true for more than two random variables.

Normally distributed and independent

If X and Y are normally distributed and independent, this implies they are "jointly normally distributed", i.e., the pair (XY) must have bivariate normal distribution. However, a pair of jointly normally distributed variables need not be independent.

Bivariate case

In the 2-dimensional nonsingular case, the probability density function (with mean (0,0)) is

<math>

f(x,y) = \frac{1}{2 \pi \sigma_x \sigma_y \sqrt{1-\rho^2}} \exp \left(

-\frac{1}{2 (1-\rho^2)}
\left[
 \frac{x^2}{\sigma_x^2} +
 \frac{y^2}{\sigma_y^2} -
 \frac{2 \rho x y}{ (\sigma_x \sigma_y)}
\right]

\right) </math>

where <math>\rho</math> is the correlation between <math>X</math> and <math>Y</math>. In this case,

<math>

\Sigma = \begin{bmatrix} \sigma_x^2 & \rho \sigma_x \sigma_y \\ \rho \sigma_x \sigma_y & \sigma_y^2 \end{bmatrix}. </math>

In the bivariate case, we also have a theorem that makes the first equivalent condition for multivariate normality more precise: It is sufficient that an infinitely countable number of distinct linear combinations of X and Y are normal. It then follows that all linear combinations are normal and that [X,Y] is bivariate normal.[1]

Affine transformation

If <math>Y = c + B X \,</math> is an affine transformation of <math>X\ \sim \mathcal{N}(\mu, \Sigma),</math> where <math>c\,</math> is an <math>M \times 1</math> vector of constants and <math>B\,</math> an <math>M \times N</math> matrix, then <math>Y\,</math> has a multivariate normal distribution with expected value <math>c + B \mu \,</math> and variance <math>B \Sigma B^T \,</math> i.e., <math>Y \sim \mathcal{N} \left(c + B \mu, B \Sigma B^T\right)</math>. In particular, any subset of the <math>X_i\,</math> has a marginal distribution that is also multivariate normal. To see this, consider the following example: to extract the subset <math>(X_1, X_2, X_4)^T \,</math>, use

<math>

B = \begin{bmatrix}

1 & 0 & 0 & 0 & 0 & \ldots & 0 \\
0 & 1 & 0 & 0 & 0 & \ldots & 0 \\
0 & 0 & 0 & 1 & 0 & \ldots & 0

\end{bmatrix} </math>

which extracts the desired elements directly.

Another corollary is that the distribution of <math>Z=b\cdot X</math>, where <math>b</math> is a vector the same length as <math>X</math> and the dot indicates a vector product, is univariate Gaussian with <math>Z\sim\mathcal{N}\left(b\cdot\mu, b^T\Sigma b\right)</math>. This result follows by using

<math>

B=\begin{bmatrix} b_1 & b_2 & \ldots & b_n \\ 0 & 0 & \ldots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \ldots & 0 \end{bmatrix} </math> and considering only the first component of the product (the first row of <math>B</math> is the vector <math>b</math>). Observe how the positive-definiteness of <math>\Sigma</math> implies that the variance of the dot product must be positive.

An affine transformation of <math>X</math> such as <math>2X</math> is not the same as the sum of two independent realisations of <math>X</math>.

Geometric interpretation

The equidensity contours of a non-singular multivariate normal distribution are ellipsoids (i.e. linear transformations of hyperspheres) centered at the mean[1]. The directions of the principal axes of the ellipsoids are given by the eigenvectors of the covariance matrix <math>\Sigma</math>. The squared relative lengths of the principal axes are given by the corresponding eigenvalues.

If <math>\Sigma=U\Lambda U^T=U\Lambda^{1/2}(U\Lambda^{1/2})^T</math> is an eigendecomposition where the columns of U are unit eigenvectors and <math>\Lambda</math> is a diagonal matrix of the eigenvalues, then we have

<math>X\ \sim N(\mu, \Sigma) \iff X\ \sim \mu+U\Lambda^{1/2}N(0, I) \iff X\ \sim \mu+UN(0, \Lambda).</math>

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

Conversely, any choice of <math>\mu</math>, full rank matrix U, and positive diagonal entries <math>\Lambda_i</math> yields a non-singular multivariate normal distribution. If any <math>\Lambda_i</math> is zero and U is square, the resulting covariance matrix <math>U\Lambda U^T</math> 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.

Correlations and independence

In general, random variables may be uncorrelated but highly 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. For an example of two normally distributed random variables that are uncorrelated but not independent, see normally distributed and uncorrelated does not imply independent.

Higher moments

The kth-order moments of X are defined by

<math>

\mu _{1,\dots,N}(X)\ \stackrel{\mathrm{def}}{=}\ \mu _{r_{1},\dots,r_{N}}(X)\ \stackrel{\mathrm{def}}{=}\ E\left[ \prod\limits_{j=1}^{N}X_j^{r_{j}}\right] </math>

where <math>r_1 +r_2 + \cdots + r_N =k.</math>

The central k-order central moments are given as follows

(a) If k is odd, <math>\mu _{1,\dots,N}(X-\mu )=0</math>.

(b) If k is even with <math>k=2\lambda</math>, then

<math>

\mu _{1,\dots,2\lambda }(X-\mu )=\sum \left( \sigma _{ij}\sigma _{k\ell}\cdots\sigma _{XZ}\right) </math>

where the sum is taken over all allocations of the set <math>\left\{ 1,\dots,2\lambda \right\}</math> into <math>\lambda</math> (unordered) pairs. That is, if you have a kth (<math>{}=2\lambda=6</math>) central moment, you will be summing the products of <math>\lambda=3</math> covariances (the -<math>\mu</math> notation has been dropped in the interests of parsimony):

<math>\begin{align}

& {} E[X_1 X_2 X_3 X_4 X_5 X_6] \\ &{} = E[X_1 X_2 ]E[X_3 X_4 ]E[X_5 X_6 ] + E[X_1 X_2 ]E[X_3 X_5 ]E[X_4 X_6] + E[X_1 X_2 ]E[X_3 X_6 ]E[X_4 X_5] \\ &{} + E[X_1 X_3 ]E[X_2 X_4 ]E[X_5 X_6 ] + E[X_1 X_3 ]E[X_2 X_5 ]E[X_4 X_6 ] + E[X_1 X_3]E[X_2 X_6]E[X_4 X_5] \\ &+ E[X_1 X_4]E[X_2 X_3]E[X_5 X_6]+E[X_1 X_4]E[X_2 X_5]E[X_3 X_6]+E[X_1 X_4]E[X_2 X_6]E[X_3 X_5] \\ & + E[X_1 X_5]E[X_2 X_3]E[X_4 X_6]+E[X_1 X_5]E[X_2 X_4]E[X_3 X_6]+E[X_1 X_5]E[X_2 X_6]E[X_3 X_4] \\ & + E[X_1 X_6]E[X_2 X_3]E[X_4 X_5 ] + E[X_1 X_6]E[X_2 X_4 ]E[X_3 X_5] + E[X_1 X_6]E[X_2 X_5]E[X_3 X_4]. \end{align}</math>

This yields <math>(2\lambda -1)!/(2^{\lambda -1}(\lambda -1)!)</math> terms in the sum (15 in the above case), each being the product of <math>\lambda</math> (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 <math>\left[ 1,\dots,2\lambda \right]</math> by the corresponding terms of the list consisting of <math>r_1</math> ones, then <math>r_2</math> twos, etc... To illustrate this, examine the following 4th-order central moment case:

<math>E\left[ X_i^4\right] = 3\sigma _{ii}^2</math>
<math>E\left[ X_i^3 X_j\right] = 3\sigma _{ii} \sigma _{ij}</math>
<math>E\left[ X_i^2 X_j^2\right] = \sigma _{ii}\sigma_{jj}+2\left( \sigma _{ij}\right) ^2</math>
<math>E\left[ X_i^2X_jX_k\right] = \sigma _{ii}\sigma _{jk}+2\sigma _{ij}\sigma _{ik}</math>
<math>E\left[ X_i X_j X_k X_n\right] = \sigma _{ij}\sigma _{kn}+\sigma _{ik}\sigma _{jn}+\sigma _{in}\sigma _{jk}.

</math>

where <math> \sigma_{ij} </math> is the covariance of <math> X_i </math> and <math> X_j</math>. The idea with the above method is you first find the general case for a <math>k</math>th moment where you have <math>k</math> different <math>X</math> variables - <math>E\left[ X_i X_j X_k X_n\right]</math> and then you can simplify this accordingly. Say, you have <math>E\left[ X_i^2 X_k X_n\right]</math> then you simply let <math>X_i = X_j</math> and realise that <math>\sigma_{ii}=\sigma_i^2</math>.

Conditional distributions

If <math>\mu</math> and <math>\Sigma</math> are partitioned as follows

<math>

\mu = \begin{bmatrix}

\mu_1 \\
\mu_2

\end{bmatrix} \quad</math> with sizes <math>\begin{bmatrix} q \times 1 \\ (N-q) \times 1 \end{bmatrix}</math>

<math>

\Sigma = \begin{bmatrix}

\Sigma_{11} & \Sigma_{12} \\
\Sigma_{21} & \Sigma_{22}

\end{bmatrix} \quad</math> with sizes <math>\begin{bmatrix} q \times q & q \times (N-q) \\ (N-q) \times q & (N-q) \times (N-q) \end{bmatrix}</math>

then the distribution of <math>x_1</math> conditional on <math>x_2=a</math> is multivariate normal <math>(X_1|X_2=a) \sim N(\bar{\mu}, \overline{\Sigma})</math> where

<math>

\bar{\mu} = \mu_1 + \Sigma_{12} \Sigma_{22}^{-1} \left(

a - \mu_2

\right) </math>

and covariance matrix

<math>

\overline{\Sigma} = \Sigma_{11} - \Sigma_{12} \Sigma_{22}^{-1} \Sigma_{21}. </math>

This matrix is the Schur complement of <math>{\mathbf\Sigma_{22}}</math> in <math>{\mathbf\Sigma}</math>. 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.

Note that knowing that <math>x_2=a</math> alters the variance, though the new variance does not depend on the specific value of <math>a</math>; perhaps more surprisingly, the mean is shifted by <math>\Sigma_{12} \Sigma_{22}^{-1} \left(a - \mu_2 \right)</math>; compare this with the situation of not knowing the value of <math>a</math>, in which case <math>x_1</math> would have distribution <math>N_q \left(\mu_1, \Sigma_{11} \right)</math>.

The matrix <math>\Sigma_{12} \Sigma_{22}^{-1}</math> is known as the matrix of regression coefficients.

In the bivariate case the conditional distribution of Y given X is

<math>Y|X=x \sim \mathcal{N}\left(\mu_y+\frac{\sigma_Y}{\sigma_X}\rho(x-\mu_X),\, (1-\rho^2)\sigma_Y\right). </math>

Bivariate conditional expectation

In the case

<math>

\begin{pmatrix}

X_1 \\
X_2

\end{pmatrix} \sim \mathcal{N} \left( \begin{pmatrix}

0 \\
0

\end{pmatrix} , \begin{pmatrix}

1 & \rho \\
\rho & 1 

\end{pmatrix} \right) </math>

then

<math>

E(X_1 | X_2 > z) = \rho { \phi(z) \over \Phi(-z) } </math>

where this latter ratio is often called the inverse Mills ratio.

Fisher information matrix

The Fisher information matrix (FIM) for a normal distribution takes a special formulation. The <math>(m,n)</math> element of the FIM for <math>X \sim N(\mu(\theta), \Sigma(\theta))</math> is

<math>

\mathcal{I}_{m,n} = \frac{\partial \mu}{\partial \theta_m} \Sigma^{-1} \frac{\partial \mu^\top}{\partial \theta_n} + \frac{1}{2} \mathrm{tr} \left(

\Sigma^{-1}
\frac{\partial \Sigma}{\partial \theta_m}
\Sigma^{-1}
\frac{\partial \Sigma}{\partial \theta_n}

\right) </math>

where

  • <math>

\frac{\partial \mu}{\partial \theta_m} = \begin{bmatrix}

\frac{\partial \mu_1}{\partial \theta_m} &
\frac{\partial \mu_2}{\partial \theta_m} &
\cdots &
\frac{\partial \mu_N}{\partial \theta_m} &

\end{bmatrix} </math>

  • <math>

\frac{\partial \mu^\top}{\partial \theta_m} = \left(

\frac{\partial \mu}{\partial \theta_m}

\right)^\top = \begin{bmatrix}

\frac{\partial \mu_1}{\partial \theta_m} \\  \\
\frac{\partial \mu_2}{\partial \theta_m} \\  \\
\vdots \\  \\
\frac{\partial \mu_N}{\partial \theta_m} \\  \\

\end{bmatrix} </math>

  • <math>

\frac{\partial \Sigma}{\partial \theta_m} = \begin{bmatrix}

\frac{\partial \Sigma_{1,1}}{\partial \theta_m} &
\frac{\partial \Sigma_{1,2}}{\partial \theta_m} &
\cdots &
\frac{\partial \Sigma_{1,N}}{\partial \theta_m} \\  \\
\frac{\partial \Sigma_{2,1}}{\partial \theta_m} &
\frac{\partial \Sigma_{2,2}}{\partial \theta_m} &
\cdots &
\frac{\partial \Sigma_{2,N}}{\partial \theta_m} \\  \\
\vdots & \vdots & \ddots & \vdots \\  \\
\frac{\partial \Sigma_{N,1}}{\partial \theta_m} &
\frac{\partial \Sigma_{N,2}}{\partial \theta_m} &
\cdots &
\frac{\partial \Sigma_{N,N}}{\partial \theta_m}

\end{bmatrix} </math>

  • <math>\mathrm{tr}</math> is the trace function

Kullback–Leibler divergence

The Kullback–Leibler divergence from <math>\mathcal{N}_0(\mu_0, \Sigma_0)</math> to <math>\mathcal{N}_1(\mu_1, \Sigma_1)</math> is:

<math>

D_\text{KL}(\mathcal{N}_0 \| \mathcal{N}_1) = { 1 \over 2 } \left( \log_e \left( { \det \Sigma_1 \over \det \Sigma_0 } \right) + \mathrm{tr} \left( \Sigma_1^{-1} \Sigma_0 \right) + \left( \mu_1 - \mu_0\right)^\top \Sigma_1^{-1} ( \mu_1 - \mu_0 ) - N \right). </math>

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 loge 2 yields the divergence in bits.

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 an N-dimensional multivariate normal is

<math>f(x)=(2 \pi)^{-N/2} \det(\Sigma)^{-1/2} \exp\left(-{1 \over 2} (x-\mu)^T \Sigma^{-1} (x-\mu)\right)</math>

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

<math>\widehat\Sigma = {1 \over n}\sum_{i=1}^n (X_i-\overline{X})(X_i-\overline{X})^T</math>

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

<math>E[\widehat\Sigma] = {n-1 \over n}\Sigma.</math>

An unbiased sample covariance is

<math>\widehat\Sigma = {1 \over n-1}\sum_{i=1}^n (X_i-\overline{X})(X_i-\overline{X})^T.</math>

Entropy

The differential entropy of the multivariate normal distribution is [1]

<math>

\begin{align} h\left(f\right) & = -\int_{-\infty}^\infty \int_{-\infty}^\infty \cdots\int_{-\infty}^\infty f(x) \ln f(x)\,dx \\ & = \frac12 \left(N+N\ln\left(2\pi\right) + \ln\left| \Sigma \right|\right) \\ & =\frac{1}{2}\ln\{(2\pi e)^N \left| \Sigma \right|\} \end{align} </math>

where <math>\left| \Sigma \right|</math> is the determinant of the covariance matrix <math>\Sigma</math>.

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 [1] and Smith and Jain's adaptation [1] of the Friedman-Rafsky test.

Drawing values from the distribution

A widely used method for drawing a random vector <math>X</math> from the <math>N</math>-dimensional multivariate normal distribution with mean vector <math>\mu</math> and covariance matrix <math>\Sigma</math> (required to be symmetric and positive-definite) works as follows:

  1. Compute the Cholesky decomposition of <math>\Sigma</math>, that is, find the unique lower triangular matrix <math>A</math> such that <math>A\,A^T = \Sigma</math> and the diagonal entries of <math>A</math> are positive. Note that any other matrix <math>A</math> satisfying the condition <math>A\,A^T = \Sigma</math> could be used, for instance the square root of <math>\Sigma</math>. However in most circumstances using Cholesky decomposition is less computationally expensive.
  2. Let <math>Z=(z_1,\dots,z_N)^T</math> be a vector whose components are <math>N</math> independent standard normal variates (which can be generated, for example, by using the Box-Muller transform).
  3. Let <math>X \,</math> be <math>\mu + AZ \,</math>. This has the desired distribution due to the affine transformation property.

See also

  • Chi distribution, the PDF of the 2-norm of a multivariate normally-distributed vector.

References


Template:ProbDistributionsde:Multivariate Verteilung#Die multivariate Normalverteilung es:Distribución normal multivariante fr:Loi normale multidimensionnelle nl:Multivariate normale verdeling pl:Wielowymiarowy rozkład normalny ru:Многомерное нормальное распределение vi:Phân phối chuẩn nhiều chiều tr:Çokdeğişirli normal dağılım zh:多变量正态分布

Personal tools
Navigation