Suvarna Garge (Editor)

Covariance matrix

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Covariance matrix

In probability theory and statistics, a covariance matrix (also known as dispersion matrix or variance–covariance matrix) is a matrix whose element in the i, j position is the covariance between the i th and j th elements of a random vector. A random vector is a random variable with multiple dimensions. Each element of the vector is a scalar random variable. Each element has either a finite number of observed empirical values or a finite or infinite number of potential values. The potential values are specified by a theoretical joint probability distribution.

Contents

Intuitively, the covariance matrix generalizes the notion of variance to multiple dimensions. As an example, the variation in a collection of random points in two-dimensional space cannot be characterized fully by a single number, nor would the variances in the x and y directions contain all of the necessary information; a 2×2 matrix would be necessary to fully characterize the two-dimensional variation.

Because the covariance of the ith random variable with itself is simply that random variable's variance, each element on the principal diagonal of the covariance matrix is the variance of one of the random variables. Because the covariance of the ith random variable with the jth one is the same thing as the covariance of the jth random variable with the ith one, every covariance matrix is symmetric. In addition, every covariance matrix is positive semi-definite.

Definition

Throughout this article, boldfaced unsubscripted X and Y are used to refer to random vectors, and unboldfaced subscripted Xi and Yi are used to refer to random scalars.

If the entries in the column vector

X = [ X 1 X n ]

are random variables, each with finite variance, then the covariance matrix Σ is the matrix whose (ij) entry is the covariance

Σ i j = c o v ( X i , X j ) = E [ ( X i μ i ) ( X j μ j ) ]

where

μ i = E ( X i )

is the expected value of the i th entry in the vector X. In other words,

Σ = [ E [ ( X 1 μ 1 ) ( X 1 μ 1 ) ] E [ ( X 1 μ 1 ) ( X 2 μ 2 ) ] E [ ( X 1 μ 1 ) ( X n μ n ) ] E [ ( X 2 μ 2 ) ( X 1 μ 1 ) ] E [ ( X 2 μ 2 ) ( X 2 μ 2 ) ] E [ ( X 2 μ 2 ) ( X n μ n ) ] E [ ( X n μ n ) ( X 1 μ 1 ) ] E [ ( X n μ n ) ( X 2 μ 2 ) ] E [ ( X n μ n ) ( X n μ n ) ] ] .

The inverse of this matrix, Σ 1 , if it exists, is the inverse covariance matrix, also known as the concentration matrix or precision matrix.

Generalization of the variance

The definition above is equivalent to the matrix equality

Σ = E [ ( X E [ X ] ) ( X E [ X ] ) T ]

This form can be seen as a generalization of the scalar-valued variance to higher dimensions. Recall that for a scalar-valued random variable X

σ 2 = v a r ( X ) = E [ ( X E ( X ) ) 2 ] = E [ ( X E ( X ) ) ( X E ( X ) ) ] .

Indeed, the entries on the diagonal of the covariance matrix Σ are the variances of each element of the vector X .

Correlation matrix

A quantity closely related to the covariance matrix is the correlation matrix, the matrix of Pearson product-moment correlation coefficients between each of the random variables in the random vector X , which can be written

corr ( X ) = ( diag ( Σ ) ) 1 2 Σ ( diag ( Σ ) ) 1 2

where diag ( Σ ) is the matrix of the diagonal elements of Σ (i.e., a diagonal matrix of the variances of X i for i = 1 , , n ).

Equivalently, the correlation matrix can be seen as the covariance matrix of the standardized random variables X i / σ ( X i ) for i = 1 , , n .

Each element on the principal diagonal of a correlation matrix is the correlation of a random variable with itself, which always equals 1. Each off-diagonal element is between 1 and –1 inclusive.

Conflicting nomenclatures and notations

Nomenclatures differ. Some statisticians, following the probabilist William Feller in his two-volume book An Introduction to Probability Theory and Its Applications, call the matrix Σ the variance of the random vector X , because it is the natural generalization to higher dimensions of the 1-dimensional variance. Others call it the covariance matrix, because it is the matrix of covariances between the scalar components of the vector X .

var ( X ) = cov ( X ) = E [ ( X E [ X ] ) ( X E [ X ] ) T ] .

Both forms are quite standard and there is no ambiguity between them. The matrix Σ is also often called the variance-covariance matrix since the diagonal terms are in fact variances.

By comparison, the notation for the cross-covariance between two vectors is

cov ( X , Y ) = C X , Y = E [ ( X E [ X ] ) ( Y E [ Y ] ) T ] .

Properties

For Σ = E [ ( X E [ X ] ) ( X E [ X ] ) T ] and μ = E ( X ) , where X is a random p-dimensional variable and Y a random q-dimensional variable, the following basic properties apply:

  1. Σ = E ( X X T ) μ μ T
  2. Σ is positive-semidefinite and symmetric.
  3. var ( A X + a ) = A var ( X ) A T
  4. cov ( X , Y ) = cov ( Y , X ) T
  5. cov ( X 1 + X 2 , Y ) = cov ( X 1 , Y ) + cov ( X 2 , Y )
  6. If p = q, then var ( X + Y ) = var ( X ) + cov ( X , Y ) + cov ( Y , X ) + var ( Y )
  7. cov ( A X + a , B T Y + b ) = A cov ( X , Y ) B
  8. If X and Y are independent (or somewhat less restrictedly, if every random variable in X is uncorrelated with every random variable in Y ), then cov ( X , Y ) = 0

where X , X 1 and X 2 are random p×1 vectors, Y is a random q×1 vector, a is a q×1 vector, b is a p×1 vector, and A and B are q×p matrices of constants.

This covariance matrix is a useful tool in many different areas. From it a transformation matrix can be derived, called a whitening transformation, that allows one to completely decorrelate the data or, from a different point of view, to find an optimal basis for representing the data in a compact way (see Rayleigh quotient for a formal proof and additional properties of covariance matrices). This is called principal components analysis (PCA) and the Karhunen-Loève transform (KL-transform).

Block matrices

The joint mean μ X , Y and joint covariance matrix Σ X , Y of X and Y can be written in block form

μ X , Y = [ μ X μ Y ] , Σ X , Y = [ Σ X X Σ X Y Σ Y X Σ Y Y ]

where Σ X X = var ( X ) , Σ Y Y = var ( Y ) , and Σ X Y = Σ Y X T = cov ( X , Y ) .

Σ X X and Σ Y Y can be identified as the variance matrices of the marginal distributions for X and Y respectively.

If X and Y are jointly normally distributed,

x , y   N ( μ X , Y , Σ X , Y ) ,

then the conditional distribution for Y given X is given by

y | x   N ( μ Y | X , Σ Y | X ) ,

defined by conditional mean

μ Y | X = μ Y + Σ Y X Σ X X 1 ( x μ X )

and conditional variance

Σ Y | X = Σ Y Y Σ Y X Σ X X 1 Σ X Y .

The matrix ΣYXΣXX−1 is known as the matrix of regression coefficients, while in linear algebra ΣY|X is the Schur complement of ΣXX in ΣX,Y

The matrix of regression coefficients may often be given in transpose form, ΣXX−1ΣXY, suitable for post-multiplying a row vector of explanatory variables xT rather than pre-multiplying a column vector x. In this form they correspond to the coefficients obtained by inverting the matrix of the normal equations of ordinary least squares (OLS).

As a parameter of a distribution

If a vector of n possibly correlated random variables is jointly normally distributed, or more generally elliptically distributed, then its probability density function can be expressed in terms of the covariance matrix.

As a linear operator

Applied to one vector, the covariance matrix maps a linear combination, c, of the random variables, X, onto a vector of covariances with those variables: c T Σ = cov ( c T X , X ) . Treated as a bilinear form, it yields the covariance between the two linear combinations: d T Σ c = cov ( d T X , c T X ) . The variance of a linear combination is then c T Σ c , its covariance with itself.

Similarly, the (pseudo-)inverse covariance matrix provides an inner product, c μ | Σ + | c μ which induces the Mahalanobis distance, a measure of the "unlikelihood" of c.

Complex random vectors

The variance of a complex scalar-valued random variable with expected value μ is conventionally defined using complex conjugation:

var ( z ) = E [ ( z μ ) ( z μ ) ]

where the complex conjugate of a complex number z is denoted z ; thus the variance of a complex number is a real number.

If Z is a column-vector of complex-valued random variables, then the conjugate transpose is formed by both transposing and conjugating. In the following expression, the product of a vector with its conjugate transpose results in a square matrix, as its expectation:

E [ ( Z μ ) ( Z μ ) ] ,

where Z denotes the conjugate transpose, which is applicable to the scalar case since the transpose of a scalar is still a scalar. The matrix so obtained will be Hermitian positive-semidefinite, with real numbers in the main diagonal and complex numbers off-diagonal.

Estimation

If M X and M Y are centred data matrices of dimension n-by-p and n-by-q respectively, i.e. with n rows of observations of p and q columns of variables, from which the column means have been subtracted, then, if the column means were estimated from the data, sample correlation matrices Q X and Q X Y can be defined to be

Q X = 1 n 1 M X T M X , Q X Y = 1 n 1 M X T M Y

or, if the column means were known a-priori,

Q X = 1 n M X T M X , Q X Y = 1 n M X T M Y

These empirical sample correlation matrices are the most straightforward and most often used estimators for the correlation matrices, but other estimators also exist, including regularised or shrinkage estimators, which may have better properties.

Applications

The covariance matrix plays a key role in financial economics, especially in portfolio theory and its mutual fund separation theorem and in the capital asset pricing model. The matrix of covariances among various assets' returns is used to determine, under certain assumptions, the relative amounts of different assets that investors should (in a normative analysis) or are predicted to (in a positive analysis) choose to hold in a context of diversification.

References

Covariance matrix Wikipedia


Similar Topics