A correlation matrix is a square matrix whose entries are the correlation coefficients between pairs of variables. In its usual form, it contains Pearson correlations, which measure linear association after accounting for differences in scale. Correlation matrices are fundamental tools in statistics: they summarize relationships among many variables and support methods such as regression, dimension reduction, and multivariate modeling.
Definition
Let be real-valued random variables with finite, strictly positive variances. Their population correlation matrix is the matrix with entries
where is their covariance and is the standard deviation of .
If is the covariance matrix of the variables and
then
Equivalently, define standardized variables
where denotes the expected value. The correlation matrix of the original variables is the covariance matrix of these standardized variables:
A variable with zero variance has no defined Pearson correlation, including with itself, because the formula divides by its standard deviation. Variables without finite second moments also fall outside this definition.
Mathematical properties
Every population Pearson correlation matrix has the following properties:
- Symmetry: .
- Unit diagonal: .
- Bounded entries: .
- Positive semidefiniteness: for every real vector .
The bound on individual entries follows from the Cauchy–Schwarz inequality. Positive semidefiniteness follows because
Thus all eigenvalues of a correlation matrix are nonnegative. Their sum is , since the diagonal entries are all one.
A correlation matrix is a positive definite matrix precisely when no nonzero linear combination of the standardized variables has zero variance. Otherwise it is singular: some exact linear relationship exists among the centered variables.
Compatibility of pairwise correlations
Symmetry, unit diagonal, and entries between and are not sufficient to make an arbitrary array a valid correlation matrix. The correlations must also be mutually compatible.
For three variables, write
In addition to , validity requires
where is the determinant. For example, two correlations of and a third correlation of cannot coexist in such a matrix.
Conversely, every real symmetric positive semidefinite matrix with unit diagonal is the correlation matrix of some random vector. One construction uses a possibly degenerate multivariate normal distribution with that matrix as its covariance matrix. This existence result does not mean that arbitrary prescribed marginal distributions can realize every such matrix.
Sample correlation matrix
For observations of variables, let be observation of variable . The usual sample Pearson correlation is
where is the sample mean.
Let be the data matrix after centering each column and dividing it by its sample standard deviation, calculated with denominator . Then
The common covariance normalization cancels in each correlation coefficient, so using denominator consistently in the covariance and variance calculations produces the same correlation matrix.
The representation as shows that the sample correlation matrix is a scaled Gram matrix and is positive semidefinite. Its rank satisfies
Consequently, if , the ordinary sample correlation matrix is necessarily singular, assuming every included column has positive sample variance.
Missing observations
When observations are missing, the way correlations are computed affects the matrix:
- Complete-case calculation uses the same observations for every variable pair. If all retained variables have positive variance, the resulting ordinary sample correlation matrix is positive semidefinite.
- Pairwise-complete calculation uses all available observations separately for each pair. It may retain more data for individual entries, but the assembled matrix need not be positive semidefinite because its entries can come from different subsets.
- Model-based estimation or imputation can produce a coherent joint estimate, but its validity depends on the method and assumptions about missingness. Missing-data imputation also affects how estimation uncertainty should be assessed.
Interpretation and geometry
A positive entry indicates that larger values of one variable tend to accompany larger values of the other in a linear sense. A negative entry indicates an opposing linear tendency. An entry close to zero indicates weak linear association, not necessarily an absence of other relationships.
The coefficients are dimensionless. Adding a constant to a variable or multiplying it by a positive constant leaves its correlations unchanged. Multiplying it by a negative constant reverses the signs of its off-diagonal correlations.
For example,
describes a strong positive linear association between the first two variables and weaker negative associations involving the third.
There is also a geometric interpretation. Center each observed variable and scale its observation vector to have unit Euclidean length. The correlation between two variables is then the inner product of their vectors, or their cosine similarity. Thus:
- correlation corresponds to identical directions;
- correlation corresponds to opposite directions;
- correlation corresponds to orthogonal directions.
For these unit vectors ,
This identity connects correlations to distances used in some forms of cluster analysis.
Alternative correlation matrices
“Correlation matrix” can also refer to a matrix constructed using association measures other than Pearson correlation. The measure should therefore be specified when ambiguity matters.
Rank-based matrices
A Spearman correlation matrix contains Pearson correlations between ranked variables. It summarizes monotonic rather than strictly linear relationships and reduces sensitivity to the numerical magnitude of extreme observations. When all columns are ranked using a common complete dataset, its positive semidefiniteness follows from the ordinary sample correlation construction.
A Kendall correlation matrix contains coefficients based on concordant and discordant observation pairs. Kendall coefficients have a different interpretation from Pearson coefficients, and different treatments of ties lead to different variants.
Rank correlations are not interchangeable with Pearson correlations. They need not represent the linear correlations of the original numerical measurements.
Partial correlation matrices
A partial correlation measures linear association after removing the linear effects of specified other variables. If is positive definite and
then the partial correlation between variables and , controlling for all remaining variables, is
Here is the inverse matrix. A table of partial correlations with diagonal entries set to one is not generally positive semidefinite, despite often being called a partial correlation matrix.
For a nonsingular multivariate normal distribution, a zero off-diagonal entry of corresponds to conditional independence between the associated variables given all the others. Outside that setting, a zero partial correlation generally establishes only the absence of the corresponding residual linear association.
Applications
Multivariate exploration
Correlation matrices provide a compact view of pairwise associations. Heatmaps often display coefficients using color, with variables reordered to reveal groups of related measurements. Such ordering changes the presentation, not the underlying coefficients.
Principal component analysis
Principal component analysis can be performed on either a covariance matrix or a correlation matrix. Using a correlation matrix is equivalent to performing covariance-based PCA after standardizing every variable to unit variance.
This gives variables equal variance before decomposition, which can be useful when their units differ substantially. It also removes original variance differences, including differences that may be scientifically meaningful.
Regression
In linear regression, the correlation matrix of predictors describes their pairwise linear relationships. Small eigenvalues can reveal near-linear dependencies involving several predictors, even when no single pair has an exceptionally high correlation.
For ordinary least squares with an intercept and standardized, full-rank predictors and response, the standardized coefficient vector satisfies
where is the predictor correlation matrix and contains predictor–response correlations.
Simulation and covariance construction
If marginal standard deviations are known, a correlation matrix determines the corresponding covariance matrix through
For a positive definite , a Cholesky decomposition can be used to generate correlated normal variables: if has independent standard normal components, then has covariance and correlation matrix . Singular matrices require a factorization that permits zero eigenvalues.
Estimation and numerical issues
Sample correlations are estimates, not exact population quantities. Their precision depends on the sample size, the underlying distribution, dependence among observations, and the sampling design. Pearson correlations can be strongly influenced by outliers.
When many variables are measured relative to the number of observations, the sample matrix may be singular or poorly conditioned. Its inverse can then be undefined or highly sensitive to small changes in the data. Regularization methods can stabilize estimation. A simple example is shrinkage toward the identity matrix:
If is positive semidefinite, this preserves the unit diagonal and is positive definite for . It reduces estimated off-diagonal correlations toward zero while introducing bias.
Rounding, pairwise deletion, or separately estimated coefficients can produce a matrix with negative eigenvalues. Methods for finding a nearby valid correlation matrix impose positive semidefiniteness and a unit diagonal. The resulting entries depend on the chosen distance criterion and constraints; repairing mathematical validity does not establish that the adjusted values are statistically well estimated.
Limitations
A correlation matrix captures only selected pairwise relationships. It generally does not determine the full joint probability distribution.
In particular:
- Zero Pearson correlation does not imply statistical independence. For jointly normal variables, however, a diagonal correlation matrix does imply mutual independence.
- Strong nonlinear dependence can coexist with zero Pearson correlation.
- Pairwise coefficients may conceal subgroup patterns, temporal structure, or higher-order relationships.
- Correlations may change after conditioning, aggregation, or selection of observations.
- A matrix of associations does not by itself establish causation; causal interpretation requires additional assumptions or evidence.
- Examining many entries introduces multiple testing issues when individual correlations are subjected to significance tests.