Jump to content

Multivariate normal distribution

From Wikipedia, the free encyclopedia
(Redirected from Multivariate Gaussian)

Template:Short description

Template:Probability distribution In probability theory and statistics, the multivariate normal distribution, multivariate Gaussian distribution, or joint normal distribution is a generalization of the one-dimensional (univariate) normal distribution to higher dimensions. One 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.

Definitions

Notation and parametrization

The multivariate normal distribution of a k-dimensional random vector <math>\mathbf{X} = (X_1,\ldots,X_k)^{\mathrm T}</math> can be written in the following notation:

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

or to make it explicitly known that <math>\mathbf{X}</math> is k-dimensional,

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

with k-dimensional mean vector

<math> \boldsymbol\mu = \operatorname{E}[\mathbf{X}] = ( \operatorname{E}[X_1], \operatorname{E}[X_2], \ldots, \operatorname{E}[X_k] ) ^ \mathrm{T}, </math>

and <math>k \times k</math> covariance matrix

<math> \Sigma_{i,j} = \operatorname{E} [(X_i - \mu_i)( X_j - \mu_j)] = \operatorname{Cov}[X_i, X_j] </math>

such that <math>1 \le i \le k</math> and <math>1 \le j \le k</math>. The inverse of the covariance matrix is called the precision matrix, denoted by <math>\boldsymbol{Q}=\boldsymbol\Sigma^{-1}</math>.

Standard normal random vector

A real random vector <math>\mathbf{X} = (X_1,\ldots,X_k)^{\mathrm T}</math> is called a standard normal random vector if all of its components <math>X_i</math> are independent and each is a zero-mean unit-variance normally distributed random variable, i.e. if <math>X_i \sim\ \mathcal{N}(0,1)</math> for all <math>i=1\ldots k</math>.[1]Template:Rp

Centered normal random vector

A real random vector <math>\mathbf{X} = (X_1,\ldots,X_k)^{\mathrm T}</math> is called a centered normal random vector if there exists a <math>k \times \ell</math> matrix <math>\boldsymbol{A}</math> such that <math>\boldsymbol{A} \mathbf{Z}</math> has the same distribution as <math>\mathbf{X}</math> where <math>\mathbf{Z}</math> is a standard normal random vector with <math>\ell</math> components.[1]Template:Rp

Normal random vector

A real random vector <math>\mathbf{X} = (X_1,\ldots,X_k)^{\mathrm T}</math> is called a normal random vector if there exists a random <math>\ell</math>-vector <math>\mathbf{Z}</math>, which is a standard normal random vector, a <math>k</math>-vector <math>\boldsymbol\mu</math>, and a <math>k \times \ell</math> matrix <math>\boldsymbol{A}</math>, such that <math>\mathbf{X}=\boldsymbol{A} \mathbf{Z} + \boldsymbol\mu</math>.[2]Template:Rp[1]Template:Rp

Formally:

Template:Equation box 1

Here the covariance matrix is <math>\boldsymbol\Sigma = \boldsymbol{A} \boldsymbol{A}^{\mathrm T}</math>.

In the degenerate case where the covariance matrix is singular, the corresponding distribution has no density; see the section below for details. This case arises frequently in statistics; for example, in the distribution of the vector of residuals in the ordinary least squares regression. The <math>X_i</math> are in general not independent; they can be seen as the result of applying the matrix <math>\boldsymbol{A}</math> to a collection of independent Gaussian variables <math>\mathbf{Z}</math>.

Equivalent definitions

The following definitions are equivalent to the definition given above. A random vector <math>\mathbf{X} = (X_1, \ldots, X_k)^\mathrm{T}</math> has a multivariate normal distribution if it satisfies one of the following equivalent conditions.

  • Every linear combination <math>Y=a_1 X_1 + \cdots + a_k X_k</math> of its components is normally distributed. That is, for any constant vector <math>\mathbf{a} \in \mathbb{R}^k</math>, the random variable <math>Y=\mathbf{a}^{\mathrm T}\mathbf{X}</math> has a univariate normal distribution, where a univariate normal distribution with zero variance is a point mass on its mean.
  • There is a k-vector <math>\mathbf{\mu}</math> and a symmetric, positive semidefinite <math>k \times k</math> matrix <math>\boldsymbol\Sigma</math>, such that the characteristic function of <math>\mathbf{X}</math> is <math display="block">
   \varphi_\mathbf{X}(\mathbf{u}) = \exp\Big( i\mathbf{u}^\mathrm{T}\boldsymbol\mu - \tfrac{1}{2} \mathbf{u}^\mathrm{T}\boldsymbol\Sigma \mathbf{u} \Big).
</math>

The spherical normal distribution can be characterised as the unique distribution where components are independent in any orthogonal coordinate system.[3][4]

Density function

File:Multivariate Gaussian.png
Bivariate normal joint density

Non-degenerate case

The multivariate normal distribution is said to be "non-degenerate" when the symmetric covariance matrix <math>\boldsymbol\Sigma</math> is positive definite. In this case the distribution has density[5]

Template:Equation box 1{\sigma_1\sigma_2}</math> is the correlation coefficient between <math>X_1</math> and <math>X_2</math>.

Bivariate conditional expectation, centered case with unit variances

<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>

The conditional expectation of X1 given X2 is

<math>\operatorname{E}(X_1 \mid X_2=x_2)= \rho x_2 </math>

and the conditional variance is

<math> \operatorname{var}(X_1 \mid X_2 = x_2) = 1-\rho^2; </math>

thus the conditional variance does not depend on x2.

The conditional expectation of X1 given that X2 is smaller/bigger than z is:[6]Template:Rp

<math>

\operatorname{E}(X_1 \mid X_2 < z) = -\rho { \varphi(z) \over \Phi(z) } , </math>

<math>

\operatorname{E}(X_1 \mid X_2 > z) = \rho { \varphi(z) \over (1- \Phi(z)) } , </math>

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

Proof: the last two results are obtained using the result <math>\operatorname{E}(X_1 \mid X_2=x_2)= \rho x_2 </math>, so that

<math>

\operatorname{E}(X_1 \mid X_2 < z) = \rho E(X_2 \mid X_2 < z)</math> 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.[7]

Example

Let Template:Nowrap be multivariate normal random variables with mean vector Template:Nowrap and covariance matrix Σ (standard parametrization for multivariate normal distributions). Then the joint distribution of Template:Nowrap is multivariate normal with mean vector Template:Nowrap and covariance matrix <math> \boldsymbol\Sigma' = \begin{bmatrix} \boldsymbol\Sigma_{11} & \boldsymbol\Sigma_{13} \\ \boldsymbol\Sigma_{31} & \boldsymbol\Sigma_{33} \end{bmatrix} </math>.

Affine transformation

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

<math>

\mathbf{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 Template:Nowrap, where b is a constant vector with the same number of elements as X and the dot indicates the dot product, is univariate Gaussian with <math>Z\sim\mathcal{N}\left(\mathbf{b}\cdot\boldsymbol\mu, \mathbf{b}^{\rm T}\boldsymbol\Sigma \mathbf{b}\right)</math>. This result follows by using

<math>

\mathbf{B}=\begin{bmatrix} b_1 & b_2 & \ldots & b_n \end{bmatrix} = \mathbf{b}^{\rm T}. </math> Observe how the positive-definiteness of Σ implies that the variance of the dot product must be positive.

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

Geometric interpretation

Template:See also

The equidensity contours of a non-singular multivariate normal distribution are ellipsoids (i.e. affine transformations of hyperspheres) centered at the mean.[8] 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 <math>\boldsymbol\Sigma</math>. The squared relative lengths of the principal axes are given by the corresponding eigenvalues.

If Template:Nowrap is an eigendecomposition where the columns of U are unit eigenvectors and Λ is a diagonal matrix of the eigenvalues, then we have

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

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ΛUT 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; this is the degenerate case.

"The radius around the true mean in a bivariate normal random variable, re-written in polar coordinates (radius and angle), follows a Hoyt distribution."[9]

In one dimension the probability of finding a sample of the normal distribution in the interval <math>\mu\pm \sigma</math> is approximately 68.27%, but in higher dimensions the probability of finding a sample in the region of the standard deviation ellipse is lower.[10]

Dimensionality Probability
1 0.6827
2 0.3935
3 0.1987
4 0.0902
5 0.0374
6 0.0144
7 0.0052
8 0.0018
9 0.0006
10 0.0002

Statistical inference

Parameter estimation

Template:Further The derivation of the maximum-likelihood estimator of the covariance matrix of a multivariate normal distribution is straightforward.

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

<math>f(\mathbf{x})= \frac{1}{\sqrt { (2\pi)^k|\boldsymbol \Sigma| } } \exp\left(-{1 \over 2} (\mathbf{x}-\boldsymbol\mu)^{\rm T} \boldsymbol\Sigma^{-1} ({\mathbf x}-\boldsymbol\mu)\right)</math>

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

<math>\widehat{\boldsymbol\Sigma} = {1 \over n}\sum_{i=1}^n ({\mathbf x}_i-\overline{\mathbf x})({\mathbf x}_i-\overline{\mathbf x})^\mathrm{T} </math>

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

<math>E\left[\widehat{\boldsymbol\Sigma}\right] = \frac{n-1}{n} \boldsymbol\Sigma.</math>

An unbiased sample covariance is

<math>\widehat{\boldsymbol\Sigma} = \frac1{n-1}\sum_{i=1}^n (\mathbf{x}_i-\overline{\mathbf{x}})(\mathbf{x}_i-\overline{\mathbf{x}})^{\rm T}
       = \frac1{n-1} \left[X'\left(I - \frac{1}{n} \cdot J\right) X\right] </math>  (matrix form; <math>I</math> is the <math>K\times K</math> identity matrix, J is a <math>K \times K</math> matrix of ones; the term in parentheses is thus the <math>K \times K</math> centering matrix)

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 <math>\mathcal{W}^{-1}</math> . Suppose then that n observations have been made

<math>\mathbf{X} = \{\mathbf{x}_1,\dots,\mathbf{x}_n\} \sim \mathcal{N}(\boldsymbol\mu,\boldsymbol\Sigma)</math>

and that a conjugate prior has been assigned, where

<math>p(\boldsymbol\mu,\boldsymbol\Sigma)=p(\boldsymbol\mu\mid\boldsymbol\Sigma)\ p(\boldsymbol\Sigma),</math>

where

<math>p(\boldsymbol\mu\mid\boldsymbol\Sigma) \sim\mathcal{N}(\boldsymbol\mu_0,m^{-1}\boldsymbol\Sigma) ,</math>

and

<math>p(\boldsymbol\Sigma) \sim \mathcal{W}^{-1}(\boldsymbol\Psi,n_0).</math>

Then[11]

<math>

\begin{array}{rcl} p(\boldsymbol\mu\mid\boldsymbol\Sigma,\mathbf{X}) & \sim & \mathcal{N}\left(\frac{n\bar{\mathbf{x}} + m\boldsymbol\mu_0}{n+m},\frac{1}{n+m}\boldsymbol\Sigma\right),\\ p(\boldsymbol\Sigma\mid\mathbf{X}) & \sim & \mathcal{W}^{-1}\left(\boldsymbol\Psi+n\mathbf{S}+\frac{nm}{n+m}(\bar{\mathbf{x}}-\boldsymbol\mu_0)(\bar{\mathbf{x}}-\boldsymbol\mu_0)', n+n_0\right), \end{array} </math> where

<math>

\begin{align} \bar{\mathbf{x}} & = \frac{1}{n}\sum_{i=1}^{n} \mathbf{x}_i ,\\ \mathbf{S} & = \frac{1}{n}\sum_{i=1}^{n} (\mathbf{x}_i - \bar{\mathbf{x}})(\mathbf{x}_i - \bar{\mathbf{x}})' . \end{align} </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[12] and Smith and Jain's adaptation[13] of the Friedman–Rafsky test created by Larry Rafsky and Jerome Friedman.[14]

Mardia's test

Mardia's test[15] is based on multivariate extensions of skewness and kurtosis measures. For a sample {x1, ..., xn} of k-dimensional vectors we compute

<math>\begin{align}
 & \widehat{\boldsymbol\Sigma} = {1 \over n} \sum_{j=1}^n \left(\mathbf{x}_j - \bar{\mathbf{x}}\right)\left(\mathbf{x}_j - \bar{\mathbf{x}}\right)^\mathrm{T} \\
 & A = {1 \over 6n} \sum_{i=1}^n \sum_{j=1}^n \left[ (\mathbf{x}_i - \bar{\mathbf{x}})^\mathrm{T}\;\widehat{\boldsymbol\Sigma}^{-1} (\mathbf{x}_j - \bar{\mathbf{x}}) \right]^3 \\
 & B = \sqrt{\frac{n}{8k(k+2)}}\left\{{1 \over n} \sum_{i=1}^n \left[ (\mathbf{x}_i - \bar{\mathbf{x}})^\mathrm{T}\;\widehat{\boldsymbol\Sigma}^{-1} (\mathbf{x}_i - \bar{\mathbf{x}}) \right]^2 - k(k+2) \right\}
 \end{align}</math>

Under the null hypothesis of multivariate normality, the statistic A will have approximately a chi-squared distribution with Template:Nowrap 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 <math>(50 \le n < 400)</math>, the parameters of the asymptotic distribution of the kurtosis statistic are modified.[16] For small sample tests (<math>n<50</math>) empirical critical values are used. Tables of critical values for both statistics are given by Rencher[17] 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.[18]

BHEP test

The BHEP test[19] 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 L2(μ) space of square-integrable functions with respect to the Gaussian weighting function <math> \mu_\beta(\mathbf{t}) = (2\pi\beta^2)^{-k/2} e^{-|\mathbf{t}|^2/(2\beta^2)}</math>. The test statistic is

<math>\begin{align}
   T_\beta &= \int_{\mathbb{R}^k} \left| {1 \over n} \sum_{j=1}^n e^{i\mathbf{t}^\mathrm{T}\widehat{\boldsymbol\Sigma}^{-1/2}(\mathbf{x}_j - \bar{\mathbf{x})}} - e^{-|\mathbf{t}|^2/2} \right|^2 \; \boldsymbol\mu_\beta(\mathbf{t}) \, d\mathbf{t} \\
           &= {1 \over n^2} \sum_{i,j=1}^n e^{-{\beta^2 \over 2}(\mathbf{x}_i-\mathbf{x}_j)^\mathrm{T}\widehat{\boldsymbol\Sigma}^{-1}(\mathbf{x}_i-\mathbf{x}_j)} - \frac{2}{n(1 + \beta^2)^{k/2}}\sum_{i=1}^n e^{ -\frac{\beta^2}{2(1+\beta^2)} (\mathbf{x}_i-\bar{\mathbf{x}})^\mathrm{T}\widehat{\boldsymbol\Sigma}^{-1}(\mathbf{x}_i-\bar{\mathbf{x}})} + \frac{1}{(1 + 2\beta^2)^{k/2}}
 \end{align}</math>

The limiting distribution of this test statistic is a weighted sum of chi-squared random variables.[19]

A detailed survey of these and other test procedures is available.[20]

Computational methods

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:[21]

  1. Find any real matrix A such that Template:Nowrap. When Σ is positive-definite, the Cholesky decomposition is typically used because it is widely available, computationally efficient, and well known. If a rank-revealing (pivoted) Cholesky decomposition such as LAPACK's dpstrf() is available, it can be used in the general positive-semidefinite case as well. A slower general alternative is to use the matrix A = UΛ1/2 obtained from a spectral decomposition Σ = UΛU−1 of Σ.
  2. Let Template:Nowrap be a vector whose components are N independent standard normal variates (which can be generated, for example, by using the Box–Muller transform).
  3. Let x be Template:Nowrap. This has the desired distribution due to the affine transformation property.

See also

References

Template:Reflist

Literature

Template:Refbegin

Template:Refend

Template:ProbDistributions Template:Statistics

  1. ↑ 1.0 1.1 1.2 Template:Cite book
  2. ↑ Template:Cite book
  3. ↑ Template:Cite journal
  4. ↑ Template:Cite journal
  5. ↑ Simon J.D. Prince(June 2012). Computer Vision: Models, Learning, and Inference Template:Webarchive. Cambridge University Press. 3.7:"Multivariate normal distribution".
  6. ↑ Template:Cite book
  7. ↑ An algebraic computation of the marginal distribution is shown here http://fourier.eng.hmc.edu/e161/lectures/gaussianprocess/node7.html Template:Webarchive. A much shorter proof is outlined here https://math.stackexchange.com/a/3832137
  8. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  9. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}Template:Dead linkTemplate:Cbignore
  10. ↑ Template:Cite journal
  11. ↑ 11.0 11.1 Template:Cite thesis
  12. ↑ Template:Cite journal
  13. ↑ Template:Cite journal
  14. ↑ Template:Cite journal
  15. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named Mardia
  16. ↑ Rencher (1995), pages 112–113.
  17. ↑ Rencher (1995), pages 493–495.
  18. ↑ Template:Cite journal
  19. ↑ 19.0 19.1 Cite error: Invalid <ref> tag; no text was provided for refs named BH
  20. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named Henze
  21. ↑ Cite error: Invalid <ref> tag; no text was provided for refs named Gentle