Part of a series on Statistics 
Correlation and covariance 

Correlation and covariance of random vectors 
Correlation and covariance of stochastic processes 
Correlation and covariance of deterministic signals Contents

In probability theory and statistics, a covariance matrix (also known as autocovariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of a given random vector. Any covariance matrix is symmetric and positive semidefinite and its main diagonal contains variances (i.e., the covariance of each element with itself).
Intuitively, the covariance matrix generalizes the notion of variance to multiple dimensions. As an example, the variation in a collection of random points in twodimensional space cannot be characterized fully by a single number, nor would the variances in the and directions contain all of the necessary information; a matrix would be necessary to fully characterize the twodimensional variation.
The covariance matrix of a random vector is typically denoted by or .
Throughout this article, boldfaced unsubscripted and are used to refer to random vectors, and unboldfaced subscripted and are used to refer to scalar random variables.
If the entries in the column vector
are random variables, each with finite variance and expected value, then the covariance matrix is the matrix whose entry is the covariance ^{ [1] }^{:p. 177}
where the operator denotes the expected value (mean) of its argument.
In other words,
The definition above is equivalent to the matrix equality
 (Eq.1) 
where .
This form ( Eq.1 ) can be seen as a generalization of the scalarvalued variance to higher dimensions. Remember that for a scalarvalued random variable
Indeed, the entries on the diagonal of the autocovariance matrix are the variances of each element of the vector .
Nomenclatures differ. Some statisticians, following the probabilist William Feller in his twovolume book An Introduction to Probability Theory and Its Applications,^{ [2] } call the matrix the variance of the random vector , because it is the natural generalization to higher dimensions of the 1dimensional variance. Others call it the covariance matrix, because it is the matrix of covariances between the scalar components of the vector .
Both forms are quite standard, and there is no ambiguity between them. The matrix is also often called the variancecovariance matrix, since the diagonal terms are in fact variances.
By comparison, the notation for the crosscovariance matrix between two vectors is
The autocovariance matrix is related to the autocorrelation matrix by
where the autocorrelation matrix is defined as .
An entity closely related to the covariance matrix is the matrix of Pearson productmoment correlation coefficients between each of the random variables in the random vector , which can be written as
where is the matrix of the diagonal elements of (i.e., a diagonal matrix of the variances of for ).
Equivalently, the correlation matrix can be seen as the covariance matrix of the standardized random variables for .
Each element on the principal diagonal of a correlation matrix is the correlation of a random variable with itself, which always equals 1. Each offdiagonal element is between −1 and +1 inclusive.
The inverse of this matrix, , if it exists, is the inverse covariance matrix, also known as the concentration matrix or precision matrix.^{ [3] }
For and , where is a dimensional random variable, the following basic properties apply:^{ [4] }
The joint mean and joint covariance matrix of and can be written in block form
where , and .
and can be identified as the variance matrices of the marginal distributions for and respectively.
If and are jointly normally distributed,
then the conditional distribution for given is given by
defined by conditional mean
The matrix is known as the matrix of regression coefficients, while in linear algebra is the Schur complement of in .
The matrix of regression coefficients may often be given in transpose form, , suitable for postmultiplying a row vector of explanatory variables rather than premultiplying a column vector . In this form they correspond to the coefficients obtained by inverting the matrix of the normal equations of ordinary least squares (OLS).
A covariance matrix with all nonzero elements tells us that all the individual random variables are interrelated. This means that the variables are not only directly correlated, but also correlated via other variables indirectly. Often such indirect, commonmode correlations are trivial and uninteresting. They can be suppressed by calculating the partial covariance matrix, that is the part of covariance matrix that shows only the interesting part of correlations.
If two vectors of random variables and are correlated via another vector , the latter correlations are suppressed in a matrix^{ [6] }
The partial covariance matrix is effectively the simple covariance matrix as if the uninteresting random variables were held constant.
If a column vector of 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 follows^{ [6] }
where and is the determinant of .
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: . Treated as a bilinear form, it yields the covariance between the two linear combinations: . The variance of a linear combination is then , its covariance with itself.
Similarly, the (pseudo)inverse covariance matrix provides an inner product , which induces the Mahalanobis distance, a measure of the "unlikelihood" of c.^{[ citation needed ]}
From the identity just above, let be a realvalued vector, then
which must always be nonnegative, since it is the variance of a realvalued random variable, so a covariance matrix is always a positivesemidefinite matrix.
The above argument can be expanded as follows:
where the last inequality follows from the observation that is a scalar.
Conversely, every symmetric positive semidefinite matrix is a covariance matrix. To see this, suppose is a symmetric positivesemidefinite matrix. From the finitedimensional case of the spectral theorem, it follows that has a nonnegative symmetric square root, which can be denoted by M^{1/2}. Let be any column vectorvalued random variable whose covariance matrix is the identity matrix. Then
The variance of a complex scalarvalued random variable with expected value is conventionally defined using complex conjugation:
where the complex conjugate of a complex number is denoted ; thus the variance of a complex random variable is a real number.
If is a column vector of complexvalued 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 called the covariance matrix, as its expectation:^{ [7] }^{:p. 293}
where 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 positivesemidefinite,^{ [8] } with real numbers in the main diagonal and complex numbers offdiagonal.
For complex random vectors, another kind of second central moment, the pseudocovariance matrix (also called relation matrix) is defined as follows. In contrast to the covariance matrix defined above Hermitian transposition gets replaced by transposition in the definition.
If and are centred data matrices of dimension and respectively, i.e. with n columns of observations of p and q rows of variables, from which the row means have been subtracted, then, if the row means were estimated from the data, sample covariance matrices and can be defined to be
or, if the row means were known a priori,
These empirical sample covariance matrices are the most straightforward and most often used estimators for the covariance matrices, but other estimators also exist, including regularised or shrinkage estimators, which may have better properties.
The 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^{[ citation needed ]} or, from a different point of view, to find an optimal basis for representing the data in a compact way^{[ citation needed ]} (see Rayleigh quotient for a formal proof and additional properties of covariance matrices). This is called principal component analysis (PCA) and the Karhunen–Loève transform (KLtransform).
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.
In covariance mapping the values of the or matrix are plotted as a 2dimensional map. When vectors and are discrete random functions, the map shows statistical relations between different regions of the random functions. Statistically independent regions of the functions show up on the map as zerolevel flatland, while positive or negative correlations show up, respectively, as hills or valleys.
In practice the column vectors , and are acquired experimentally as rows of samples, e.g.
where is the ith discrete value in sample j of the random function . The expected values needed in the covariance formula are estimated using the sample mean, e.g.
and the covariance matrix is estimated by the sample covariance matrix
where the angular brackets denote sample averaging as before except that the Bessel's correction should be made to avoid bias. Using this estimation the partial covariance matrix can be calculated as
where the backslash denotes the left matrix division operator, which bypasses the requirement to invert a matrix and is available in some computational packages such as Matlab.^{ [9] }
Fig. 1 illustrates how a partial covariance map is constructed on an example of an experiment performed at the FLASH freeelectron laser in Hamburg.^{ [10] } The random function is the timeofflight spectrum of ions from a Coulomb explosion of nitrogen molecules multiply ionised by a laser pulse. Since only a few hundreds of molecules are ionised at each laser pulse, the singleshot spectra are highly fluctuating. However, collecting typically such spectra, , and averaging them over produces a smooth spectrum , which is shown in red at the bottom of Fig. 1. The average spectrum reveals several nitrogen ions in a form of peaks broadened by their kinetic energy, but to find the correlations between the ionisation stages and the ion momenta requires calculating a covariance map.
In the example of Fig. 1 spectra and are the same, except that the range of the timeofflight differs. Panel a shows , panel b shows and panel c shows their difference, which is (note a change in the colour scale). Unfortunately, this map is overwhelmed by uninteresting, commonmode correlations induced by laser intensity fluctuating from shot to shot. To suppress such correlations the laser intensity is recorded at every shot, put into and is calculated as panels d and e show. The suppression of the uninteresting correlations is, however, imperfect because there are other sources of commonmode fluctuations than the laser intensity and in principle all these sources should be monitored in vector . Yet in practice it is often sufficient to overcompensate the partial covariance correction as panel f shows, where interesting correlations of ion momenta are now clearly visible as straight lines centred on ionisation stages of atomic nitrogen.
Twodimensional infrared spectroscopy employs correlation analysis to obtain 2D spectra of the condensed phase. There are two versions of this analysis: synchronous and asynchronous. Mathematically, the former is expressed in terms of the sample covariance matrix and the technique is equivalent to covariance mapping.^{ [11] }
Autocorrelation, also known as serial correlation, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations as a function of the time lag between them. The analysis of autocorrelation is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal obscured by noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals.
In probability theory and statistics, variance is the expectation of the squared deviation of a random variable from its mean. In other words, it measures how far a set of numbers is spread out from their average value. Variance has a central role in statistics, where some ideas that use it include descriptive statistics, statistical inference, hypothesis testing, goodness of fit, and Monte Carlo sampling. Variance is an important tool in the sciences, where statistical analysis of data is common. The variance is the square of the standard deviation, the second central moment of a distribution, and the covariance of the random variable with itself, and it is often represented by , , or .
The weighted arithmetic mean is similar to an ordinary arithmetic mean, except that instead of each of the data points contributing equally to the final average, some data points contribute more than others. The notion of weighted mean plays a role in descriptive statistics and also occurs in a more general form in several other areas of mathematics.
In probability theory, the central limit theorem (CLT) establishes that, in many situations, when independent random variables are added, their properly normalized sum tends toward a normal distribution even if the original variables themselves are not normally distributed. The theorem is a key concept in probability theory because it implies that probabilistic and statistical methods that work for normal distributions can be applicable to many problems involving other types of distributions. This theorem has seen many changes during the formal development of probability theory. Previous versions of the theorem date back to 1811, but in its modern general form, this fundamental result in probability theory was precisely stated as late as 1920, thereby serving as a bridge between classical and modern probability theory.
In probability, and statistics, a multivariate random variable or random vector is a list of mathematical variables each of whose value is unknown, either because the value has not yet occurred or because there is imperfect knowledge of its value. The individual variables in a random vector are grouped together because they are all part of a single mathematical system — often they represent different properties of an individual statistical unit. For example, while a given person has a specific age, height and weight, the representation of these features of an unspecified person from within a group would be a random vector. Normally each element of a random vector is a real number.
In probability theory and statistics, the multivariate normal distribution, multivariate Gaussian distribution, or joint normal distribution is a generalization of the onedimensional (univariate) normal distribution to higher dimensions. One definition is that a random vector is said to be kvariate 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 realvalued random variables each of which clusters around a mean value.
In probability theory and statistics, covariance is a measure of the joint variability of two random variables. If the greater values of one variable mainly correspond with the greater values of the other variable, and the same holds for the lesser values, the covariance is positive. In the opposite case, when the greater values of one variable mainly correspond to the lesser values of the other,, the covariance is negative. The sign of the covariance therefore shows the tendency in the linear relationship between the variables. The magnitude of the covariance is not easy to interpret because it is not normalized and hence depends on the magnitudes of the variables. The normalized version of the covariance, the correlation coefficient, however, shows by its magnitude the strength of the linear relation.
In probability theory and statistics, two realvalued random variables, , , are said to be uncorrelated if their covariance, , is zero. If two variables are uncorrelated, there is no linear relationship between them.
In estimation theory and statistics, the Cramér–Rao bound (CRB) expresses a lower bound on the variance of unbiased estimators of a deterministic parameter, stating that the variance of any such estimator is at least as high as the inverse of the Fisher information. The result is named in honor of Harald Cramér and C. R. Rao, but has independently also been derived by Maurice Fréchet, Georges Darmois, as well as Alexander Aitken and Harold Silverstone.
In signal processing, crosscorrelation is a measure of similarity of two series as a function of the displacement of one relative to the other. This is also known as a sliding dot product or sliding innerproduct. It is commonly used for searching a long signal for a shorter, known feature. It has applications in pattern recognition, single particle analysis, electron tomography, averaging, cryptanalysis, and neurophysiology. The crosscorrelation is similar in nature to the convolution of two functions. In an autocorrelation, which is the crosscorrelation of a signal with itself, there will always be a peak at a lag of zero, and its size will be the signal energy.
In statistics, sometimes the covariance matrix of a multivariate random variable is not known but has to be estimated. Estimation of covariance matrices then deals with the question of how to approximate the actual covariance matrix on the basis of a sample from the multivariate distribution. Simple cases, where observations are complete, can be dealt with by using the sample covariance matrix. The sample covariance matrix (SCM) is an unbiased and efficient estimator of the covariance matrix if the space of covariance matrices is viewed as an extrinsic convex cone in R^{p×p}; however, measured using the intrinsic geometry of positivedefinite matrices, the SCM is a biased and inefficient estimator. In addition, if the random variable has normal distribution, the sample covariance matrix has Wishart distribution and a slightly differently scaled version of it is the maximum likelihood estimate. Cases involving missing data require deeper considerations. Another issue is the robustness to outliers, to which sample covariance matrices are highly sensitive.
In probability and statistics, given two stochastic processes and , the crosscovariance is a function that gives the covariance of one process with the other at pairs of time points. With the usual notation ; for the expectation operator, if the processes have the mean functions and , then the crosscovariance is given by
In multivariate statistics, if is a vector of random variables, and is an dimensional symmetric matrix, then the scalar quantity is known as a quadratic form in .
In probability and statistics, a natural exponential family (NEF) is a class of probability distributions that is a special case of an exponential family (EF).
In probability theory and statistics, the normalinversegamma distribution is a fourparameter family of multivariate continuous probability distributions. It is the conjugate prior of a normal distribution with unknown mean and variance.
In statistics and in particular in regression analysis, leverage is a measure of how far away the independent variable values of an observation are from those of the other observations.
In probability theory and statistics, a crosscovariance matrix is a matrix whose element in the i, j position is the covariance between the ith element of a random vector and jth element of another 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. Intuitively, the crosscovariance matrix generalizes the notion of covariance to multiple dimensions.
In probability theory, the family of complex normal distributions characterizes complex random variables whose real and imaginary parts are jointly normal. The complex normal family has three parameters: location parameter μ, covariance matrix , and the relation matrix . The standard complex normal is the univariate distribution with , , and .
In statistics and in probability theory, distance correlation or distance covariance is a measure of dependence between two paired random vectors of arbitrary, not necessarily equal, dimension. The population distance correlation coefficient is zero if and only if the random vectors are independent. Thus, distance correlation measures both linear and nonlinear association between two random variables or random vectors. This is in contrast to Pearson's correlation, which can only detect linear association between two random variables.
In statistics, modes of variation are a continuously indexed set of vectors or functions that are centered at a mean and are used to depict the variation in a population or sample. Typically, variation patterns in the data can be decomposed in descending order of eigenvalues with the directions represented by the corresponding eigenvectors or eigenfunctions. Modes of variation provide a visualization of this decomposition and an efficient description of variation around the mean. Both in principal component analysis (PCA) and in functional principal component analysis (FPCA), modes of variation play an important role in visualizing and describing the variation in the data contributed by each eigencomponent. In realworld applications, the eigencomponents and associated modes of variation aid to interpret complex data, especially in exploratory data analysis (EDA).
journal=
(help)