Understanding Correlation Matrices
Part 1 of the CorrFlow series. Introduction and reading plan.
Contents
- From covariance to correlation
- A few short matrix exercises
- Geometry beyond the heatmap
- Pearson Spearman and Kendall measure different things
- Correlation matrices estimated from data
- Correlations copulas and joint dependence
- Structured correlation models worth knowing
- What changes across applications
- A small calculation to keep nearby
Definitions, geometry, estimation and dependence, with short proofs and numerical examples.
A correlation matrix collects the pairwise correlations of several variables. In finance, these might be stock returns. In neuroscience, they might be signals recorded from different brain regions. In a spatial dataset, they might be temperature measurements at different locations.
The matrix has a mathematical structure before we attach any application to it. Its entries must fit together: individually plausible correlations can describe an impossible system. Once we estimate the matrix from data, a second set of questions appears. What exactly are we estimating? How uncertain is the estimate? Which properties come from the underlying system, and which come from the observations and estimator?
These questions have appeared throughout this blog, from stock correlations and clusters in 2017 to CorrFlow. Here I want to build the foundations more systematically. We will move between linear algebra, geometry, probability and statistical estimation, keeping small examples that we can calculate ourselves.
We use p for the number of variables and n for the number of observations. The population covariance matrix is Σ, its population Pearson correlation matrix is R, the sample covariance is S, and the sample Pearson matrix is R̂. An observation is a complete vector of measurements of the p variables.
From covariance to correlation
Standardizing the variables
Let X be a real random vector with finite second moments. Write μ for its mean vector and assume that every component has strictly positive variance. The covariance matrix is
\[\Sigma=\mathbb E[(X-\mu)(X-\mu)^\top], \qquad \Sigma_{ij}=\operatorname{Cov}(X_i,X_j).\]Let D be the diagonal matrix of population standard deviations. Standardizing each variable gives
\[D=\operatorname{diag}(\sigma_1,\ldots,\sigma_p), \qquad Z=D^{-1}(X-\mu), \qquad R=D^{-1}\Sigma D^{-1}.\]Thus
\[R_{ij}=\rho_{ij} =\frac{\operatorname{Cov}(X_i,X_j)}{\sigma_i\sigma_j} =\mathbb E[Z_iZ_j].\]Each standardized variable has mean zero and variance one. This explains the ones on the diagonal.
Covariance retains the units of measurement: changing returns from decimals to percentages changes their covariance matrix. Correlation removes positive changes of scale and shifts of origin. Multiplying one variable by a negative number reverses the signs of its correlations with the others.
We can recover covariance from correlation once we supply the standard deviations:
\[\Sigma=DRD.\]This matters for portfolios. The variance of a portfolio with weights w is
\[\operatorname{Var}(w^\top X)=w^\top\Sigma w=(Dw)^\top R(Dw).\]Two portfolios can have the same correlation matrix and very different risks because their volatilities differ. The expression wᵀRw is the variance of a weighted combination of standardized variables.
The algebraic definition and its statistical meaning
A real p-by-p matrix is a correlation matrix if and only if
\[R=R^\top,\qquad R_{ii}=1,\qquad a^\top Ra\geq0\quad\text{for every }a\in\mathbb R^p.\]The final condition is positive semidefiniteness. It constrains the whole matrix. It says that every linear combination of the standardized variables has a nonnegative variance, since
\[a^\top Ra=\operatorname{Var}(a^\top Z).\]If the inequality is strict whenever a is nonzero, the matrix is positive definite. If some nonzero combination has zero variance, the matrix is singular: the standardized variables satisfy an exact linear relation almost surely.
These conditions are also sufficient for a population Pearson correlation matrix, when we are free to choose the marginal distributions. To see this, factor a positive semidefinite R as AAᵀ, take a vector G of independent standard Gaussian variables, and set Z = AG. Then Cov(Z) = R and each component has variance one. A singular R simply gives a degenerate Gaussian vector.
Prescribing particular non-Gaussian margins introduces extra restrictions; the unrestricted existence argument above does not settle that different problem. Nick Higham’s introduction is a useful reference for the matrix definition and related numerical questions.
The same matrix is a Gram matrix
Write the rows of A as vectors u₁, …, uₚ. Because R = AAᵀ,
\[R_{ij}=u_i^\top u_j,\qquad \|u_i\|=1.\]A correlation matrix is therefore a Gram matrix of unit vectors. Conversely, any collection of unit vectors gives a correlation matrix.
This gives an angular interpretation:
\[\rho_{ij}=\cos\theta_{ij}.\]A correlation of one means coincident unit vectors; zero means orthogonality; minus one means opposite directions. The vectors need not live in two or three dimensions. Their smallest possible ambient dimension is the rank of R.
The same interpretation works directly for random variables: centered, unit-variance variables are unit vectors in the Hilbert space of square-integrable random variables, with inner product E[UV]. Linear algebra and probability are describing the same object.
A few short matrix exercises
These exercises are useful because each proof exposes a constraint that is easy to miss in a heatmap.
Exercise 1 Bounds on a single coefficient
Question. Why must every correlation lie between minus one and one?
Proof. Using the Gram representation and Cauchy–Schwarz,
\[|\rho_{ij}|=|u_i^\top u_j| \leq\|u_i\|\|u_j\|=1.\]Equivalently, every two-variable principal submatrix must have nonnegative determinant:
\[\det\begin{pmatrix}1&\rho\\\rho&1\end{pmatrix} =1-\rho^2\geq0.\]This is the complete constraint for two variables. Starting with three variables, additional compatibility conditions appear.
Exercise 2 The exact constraint on three correlations
Write
\[R=\begin{pmatrix} 1&a&b\\ a&1&c\\ b&c&1 \end{pmatrix}.\]Question. Suppose a, b and c each lie in [−1, 1]. What else is needed?
For this three-variable matrix, positive semidefiniteness is equivalent to
\[\det R=1+2abc-a^2-b^2-c^2\geq0.\]Proof. A real symmetric matrix is positive semidefinite if and only if all of its principal minors are nonnegative. Here the one-variable minors are one, the two-variable minors are nonnegative by assumption, and the displayed determinant is the remaining minor. “All principal minors” includes every choice of matching row and column indices. For positive definiteness, Sylvester’s criterion uses positive leading principal minors; replacing “positive” by “nonnegative” in that leading-minor test is not a general test for semidefiniteness.
Rearranging the determinant condition gives a more informative answer:
\[(c-ab)^2\leq(1-a^2)(1-b^2),\]and hence
\[ab-\sqrt{(1-a^2)(1-b^2)} \leq c\leq ab+\sqrt{(1-a^2)(1-b^2)}.\]If A is correlated 0.9 with B and 0.9 with C, the correlation between B and C must lie between 0.62 and 1. Choosing −0.9 is impossible.
For that impossible choice, the eigenvalues are −0.8, 1.9 and 1.9. The weights (−1, 1, 1) would give a variance of −2.4. The problem is the proposed relationships, not a failure of the variance formula.
Fixing a and plotting the allowed pairs (b, c) gives an elliptical slice of the feasible region.
With Corr(A, B) fixed at 0.6, the shaded region contains compatible choices for the other two correlations. Each axis separately allows [−1, 1], but the pair must stay inside the ellipse.
Exercise 3 Perfect correlation constrains an entire row
Question. If two variables have correlation one, what can we say about their correlations with every other variable?
Proof. For standardized variables,
\[\operatorname{Var}(Z_i-Z_j)=2(1-\rho_{ij}).\]If ρᵢⱼ = 1, this variance is zero, so Zᵢ = Zⱼ almost surely. Their correlations with every other variable are therefore identical. If ρᵢⱼ = −1, their standardized values are opposites and the corresponding rows have opposite signs.
For the original, unstandardized variables, correlation one means an exact increasing affine relationship. It does not require identical levels or volatilities.
Exercise 4 Eigenvalues and determinant
Question. What do the unit diagonal and positive semidefiniteness imply about the spectrum?
Proof. The eigenvalues λ₁, …, λₚ are nonnegative, and
\[\sum_{i=1}^{p}\lambda_i=\operatorname{tr}(R)=p.\]Therefore each eigenvalue is at most p, and the largest is at least one. Also, by the arithmetic–geometric mean inequality,
\[0\leq\det R=\prod_{i=1}^{p}\lambda_i \leq\left(\frac{\sum_i\lambda_i}{p}\right)^p=1.\]Equality det R = 1 holds only when every eigenvalue is one, which for a symmetric matrix means R = I. The all-ones matrix has eigenvalues p, 0, …, 0: all variation is concentrated in one standardized direction.
PCA reads these eigenvalues as variances along orthogonal directions. My 2019 discussion of financial correlation statistics explored the large first eigenvalue seen in equity data.
Exercise 5 Conditioning and partial correlation
Question. How can two variables be correlated merely because both relate to a third variable?
Regress standardized Z₁ and Z₂ separately on standardized Z₃. Their linear residuals are Z₁ − bZ₃ and Z₂ − cZ₃. Direct calculation gives
\[\operatorname{Cov}(Z_1-bZ_3,Z_2-cZ_3)=a-bc,\]with residual variances 1 − b² and 1 − c². When both are positive, their correlation is
\[\rho_{12\cdot3} =\frac{a-bc}{\sqrt{(1-b^2)(1-c^2)}}.\]This is a partial correlation. Its magnitude cannot exceed one, recovering the constraint from Exercise 2.
For general distributions it measures association between linear residuals. Under a jointly Gaussian model, it is also the conditional correlation given Z₃. Zero partial correlation then implies the corresponding conditional independence. Without the Gaussian assumption, that implication can fail.
For a positive-definite R with inverse K, the general formula is
\[\rho_{ij\cdot\mathrm{rest}} =-\frac{K_{ij}}{\sqrt{K_{ii}K_{jj}}}.\]A graph based on the inverse matrix therefore answers a different question from a graph based on the raw correlations.
Geometry beyond the heatmap
The elliptope is a convex body
The set of real correlation matrices is called the elliptope:
\[\mathcal E_p=\{R\in\mathbb S^p:R\succeq0,\ \operatorname{diag}(R)=\mathbf1\}.\]It is a compact convex subset of the affine space of symmetric unit-diagonal matrices, with dimension p(p − 1)/2. Positive-definite matrices form its relative interior; singular matrices form its boundary.
Convexity has a short proof. If R₀ and R₁ are correlation matrices and 0 ≤ t ≤ 1, then
\[R_t=(1-t)R_0+tR_1\]is symmetric with unit diagonal, and aᵀRₜa is a convex combination of two nonnegative numbers. Thus averaging correlation matrices arithmetically preserves validity.
This does not prescribe the best average for every application. It establishes a precise property of that particular operation.
Correlations give distances between variables
The Gram interpretation gives
\[\|u_i-u_j\|^2 =\|u_i\|^2+\|u_j\|^2-2u_i^\top u_j =2(1-\rho_{ij}).\]So the square root of 2(1 − ρᵢⱼ) is a Euclidean distance between the unit-vector representations. It can be a pseudometric on the variable labels, since distinct labels with correlation one have zero distance. The unsquared-rooted quantity 1 − ρ is proportional to squared distance and need not satisfy the triangle inequality.
Clustering variables using these distances studies the configuration represented by a matrix. Comparing two whole matrices is another geometric problem. I used the first viewpoint in sorting distance matrices and the early clustering experiments.
Covariance geodesics can leave the correlation subset
Covariance matrices have several useful Riemannian geometries. Under the usual affine-invariant metric, the geodesic between positive-definite A and B is
\[G_t=A^{1/2}(A^{-1/2}BA^{-1/2})^tA^{1/2}.\]Even if A and B both have unit diagonal, intermediate points need not.
Take A = I and B with diagonal one and off-diagonal correlation r. The midpoint is B¹ᐟ². Its two diagonal entries are
\[\frac{\sqrt{1+r}+\sqrt{1-r}}{2},\]which are less than one when r is nonzero. For r = 0.6, both equal approximately 0.9487.
Thus the correlation subset is not totally geodesic under this covariance geometry. This is the issue illustrated in my 2019 animation about Riemannian correlation means. The arithmetic segment stays inside the elliptope; the affine-invariant covariance geodesic can leave it. The distinction depends on the chosen metric.
Later work developed geometries directly on full-rank correlation matrices, including those of Thanwerdas and Pennec. Another route uses a smooth change of coordinates. Archakov and Hansen’s generalized Fisher parametrization maps positive-definite correlation matrices to unrestricted real vectors through the off-diagonal entries of the matrix logarithm.
We will return to that construction later in the series. At this stage, the important question is which operations and invariances a chosen geometry provides.
Pearson Spearman and Kendall measure different things
Pearson correlation
Pearson’s population coefficient is the standardized covariance defined above. It requires finite, positive variances. It quantifies the linear component of association and is unchanged by increasing affine transformations.
Its definition does not assume Gaussian data. Gaussianity becomes important for particular inference formulas and for interpreting zero correlation as independence. In a jointly Gaussian vector, a zero off-diagonal entry gives independence of the corresponding pair. For an arbitrary distribution, it does not.
Also distinguish a population functional, such as Pearson correlation, from a sample statistic, such as the usual sample correlation r. Saying that a population coefficient “is an estimator” confuses the target with the procedure used to estimate it.
Spearman correlation
For variables with continuous marginal CDFs Fₓ and Fᵧ, set U = Fₓ(X) and V = Fᵧ(Y). Both are uniform on [0, 1]. Spearman’s population coefficient is their Pearson correlation:
\[\rho_S=\operatorname{Corr}(U,V)=12\mathbb E[UV]-3.\]It measures association between percentile positions. Applying a strictly increasing transformation to either original variable leaves those positions unchanged. The original variables need not have finite variances.
The usual sample Spearman statistic is the Pearson correlation of the two rank vectors. With no ties, an equivalent formula is
\[r_S=1-\frac{6\sum_{t=1}^{n}(r_t-s_t)^2}{n(n^2-1)}.\]Here rₜ and sₜ are ranks. With ties, use an explicit ranking convention, usually average ranks, and calculate their Pearson correlation. The simplified formula above assumes no ties. For discrete margins, the population definition also needs a convention; continuous-margin formulas cannot simply be copied unchanged.
Kendall correlation
Take an independent copy (X′, Y′) of (X, Y). A pair is concordant if the order of X and X′ agrees with the order of Y and Y′, and discordant if the orders disagree. For continuous margins,
\[\tau =\mathbb P((X-X')(Y-Y')>0) -\mathbb P((X-X')(Y-Y')<0).\]The sample version without ties averages over pairs of observations:
\[\widehat\tau =\frac{2}{n(n-1)} \sum_{s<t} \operatorname{sign}(X_s-X_t)\operatorname{sign}(Y_s-Y_t).\]Under independent identically distributed observations, each term has expectation τ, so this estimator is unbiased. It is a U-statistic. Although there are n(n − 1)/2 pairs, they share observations and are not independent; they do not supply a quadratic increase in independent information. Tie-corrected Kendall τᵦ uses a different normalization.
R’s correlation documentation makes these implementation conventions explicit.
All three can miss a nonlinear relationship
Let X be uniform on [−1, 1] and set Y = X². Knowing X determines Y exactly.
Nevertheless Pearson correlation is zero: E[X] = E[X³] = 0, so Cov(X, X²) = 0. Spearman correlation is also zero, because the marginal percentile transformations reduce to (X + 1)/2 and the absolute value of X, whose covariance is zero by symmetry. Finally,
\[\operatorname{sign}((X-X')(X^2-X'^2)) =\operatorname{sign}(X+X') \quad\text{almost surely},\]whose expectation is zero by symmetry. Kendall’s τ is zero too.
The relationship is U-shaped rather than monotone. None of these three scalar summaries describes it well. This was one motivation for visualizing dependence directly in the earlier blog experiments.
From one coefficient to a whole rank correlation matrix
Population Spearman matrices are positive semidefinite because they are Pearson matrices of percentile-transformed variables. On a common complete sample, the same Gram argument applies to sample rank vectors.
Kendall matrices also have a Gram interpretation. Define a vector of signs using an independent copy of the whole random vector:
\[S_i=\operatorname{sign}(X_i-X_i'), \qquad T_{ij}=\mathbb E[S_iS_j].\]With continuous margins, each Sᵢ² = 1. Thus T has unit diagonal and is positive semidefinite. For a common sample without ties, the empirical matrix is an average of outer products of sign vectors. Tie-corrected sample matrices can likewise be viewed as normalized Gram matrices of pairwise sign vectors, provided each variable is nonconstant.
But the set of possible Kendall matrices is more restricted than the full Pearson elliptope. Here is a short example.
For any three signs s₁, s₂, s₃ in {−1, 1},
\[s_1s_2+s_1s_3+s_2s_3\in\{-1,3\}.\]Taking expectations implies τ₁₂ + τ₁₃ + τ₂₃ ≥ −1. A matrix with all three off-diagonal entries −1/2 is a valid Pearson matrix, but cannot be a Kendall matrix: its sum is −3/2. McNeil, Nešlehová and Smith characterize this extra compatibility structure.
We should therefore specify which matrix we mean when we say “the correlation matrix.”
Correlation matrices estimated from data
Parameter estimator and estimate
A parameter describes the population or statistical model: for example, the Pearson correlation ρ or the matrix R.
An estimator is a rule applied to random data. Before we observe a sample, its output is a random variable or random matrix.
An estimate is the numerical output for the sample we actually observed.
To study an estimator, we must specify how data are generated. Begin with n independent identically distributed p-dimensional observations X₁, …, Xₙ from one fixed distribution, with finite second moments and nonzero marginal variances. Define
\[\bar X=\frac1n\sum_{t=1}^{n}X_t, \qquad S=\frac1{n-1}\sum_{t=1}^{n}(X_t-\bar X)(X_t-\bar X)^\top,\]and
\[\widehat R_{ij}=\frac{S_{ij}}{\sqrt{S_{ii}S_{jj}}}.\]Assume the observed variances in the denominator are positive. This is the usual sample Pearson matrix.
Under the assumptions above, S is unbiased: E[S] = Σ. The normalization by random sample standard deviations is nonlinear, so R̂ is not generally unbiased for R. The usual claim of unbiased sample covariance does not transfer automatically to sample correlation.
For fixed p, the law of large numbers gives consistency of S and R̂ under these assumptions. Consistency means convergence to the population target as n increases. It does not quantify the error at a particular finite n.
Exercise 6 Why the sample matrix can be singular
Let Y be the n-by-p centered data matrix, with observations in rows. If Dₛ is the diagonal matrix of sample standard deviations, define A = YDₛ⁻¹/√(n − 1). Then
\[\widehat R=A^\top A.\]Its columns have unit norm. Centering makes the columns orthogonal to the all-ones observation vector, so
\[\operatorname{rank}(\widehat R) \leq\min(p,n-1).\]Consequently, p ≥ n forces singularity. Having n > p allows positive definiteness, but does not guarantee it: exact linear relationships or duplicated columns can still reduce rank.
For 300 assets and 252 observed daily returns, the ordinary sample correlation matrix is necessarily singular. This is a structural limitation of the observation matrix, even when the population matrix is perfectly well conditioned.
Repeated estimates can differ without a market change
Hold one population matrix fixed, draw different samples from the same distribution, and calculate a correlation matrix from each sample. The estimates differ because the observations differ.
The accompanying synthetic example holds a 24-variable population matrix fixed and compares estimates from 40 and 400 independent Gaussian observations. The larger sample generally makes the block structure easier to estimate; neither experiment changes the population matrix.
A fixed 24-variable population matrix and two estimates from independent Gaussian samples. The population has cross-block correlation 0.15 and within-block correlation 0.50. Only the observed sample and its size change.
For independent Gaussian observations, the sampling law of the covariance matrix is particularly explicit:
\[(n-1)S\sim W_p(\Sigma,n-1), \qquad \operatorname{Var}(S_{ij}) =\frac{\Sigma_{ij}^2+\Sigma_{ii}\Sigma_{jj}}{n-1}.\]The Wishart distribution is the matrix analogue of the chi-squared construction: it is the distribution of sums of outer products of independent centered Gaussian vectors. The degrees of freedom here are n − 1 because we estimated the mean. R̂ itself is not Wishart; its diagonal has been normalized to one.
Under non-Gaussian data, that exact sampling law disappears. Fourth moments affect covariance-estimation variances. Without suitable fourth moments, familiar square-root-n normal approximations can also fail.
How uncertain is one estimated coefficient
For n independent observations from a bivariate normal distribution, with unknown means and variances and −1 < ρ < 1, the sample Pearson coefficient satisfies
\[\sqrt n(r-\rho)\ \xrightarrow{d}\ N\bigl(0,(1-\rho^2)^2\bigr).\]For intuition, the first-order error is an average of terms of the form
\[\psi(Z_1,Z_2) =Z_1Z_2-\frac{\rho}{2}(Z_1^2+Z_2^2),\]where Z₁ and Z₂ are population-standardized observations. Under bivariate normality, Gaussian fourth-moment identities give Var(ψ) = (1 − ρ²)². For a different joint distribution, the variance of this same expression can be different.
Fisher’s transformation makes the approximate uncertainty easier to handle:
\[z=\operatorname{atanh}(r) =\frac12\log\frac{1+r}{1-r}, \qquad \operatorname{se}(z)\approx\frac1{\sqrt{n-3}}.\]An approximate 95% interval for the population coefficient is obtained by transforming the endpoints back:
\[\tanh\left[ \operatorname{atanh}(r) \ \pm\ \frac{1.96}{\sqrt{n-3}} \right].\]For r = 0.5 from 252 independent bivariate normal observations, the interval is approximately [0.401, 0.587]. The 252 observations have not pinned the coefficient down to a few decimal places.
This is a repeated-sampling confidence procedure: under its assumptions, approximately 95% of intervals constructed this way cover the fixed population correlation. It is not a posterior probability statement about that parameter.
Under the additional null hypothesis ρ = 0, the classical statistic
\[t=r\sqrt{\frac{n-2}{1-r^2}}\]has a Student t distribution with n − 2 degrees of freedom. These normal-model inference procedures are described in R’s correlation-test documentation.
A matrix introduces a further issue: 80 assets give 3,160 pairs. Separate 95% intervals are not a simultaneous 95% confidence region for the whole matrix, and independently chosen interval endpoints need not assemble into a valid matrix.
Sufficiency has a precise model dependent meaning
A statistic T is sufficient for a specified statistical family if the conditional distribution of the complete data given T does not depend on the unknown parameters. It preserves the information about those parameters available within that model. This is the definition used in Will Fithian’s notes on sufficiency.
For independent multivariate Gaussian observations with unknown mean μ and positive-definite covariance Σ, the likelihood depends on the observations through
\[T_1=\sum_{t=1}^{n}X_t, \qquad T_2=\sum_{t=1}^{n}X_tX_t^\top.\]Indeed, expanding the Gaussian likelihood gives, up to a constant independent of the parameters,
\[L(\mu,\Sigma) \propto|\Sigma|^{-n/2} \exp\left[ -\frac12\operatorname{tr}\left\{ \Sigma^{-1} \left(T_2-T_1\mu^\top-\mu T_1^\top+n\mu\mu^\top\right) \right\} \right].\]The factorization shows that (T₁, T₂), or equivalently (X̄, S), is sufficient for the full Gaussian parameter. The sample correlation matrix alone drops sample means and marginal scales, so it is not sufficient for that full parameter.
The model qualification matters. Discarding time order loses no information under an independent Gaussian sampling model, but can discard precisely the information needed in a time-series model. A covariance or correlation matrix is not generally sufficient for an arbitrary multivariate distribution.
Efficiency is a property of an estimation problem
An unbiased estimator has the correct expectation. An efficient estimator uses information well according to a specified criterion. In regular scalar parametric models, the Cramér–Rao bound limits the variance of unbiased estimators; in asymptotic comparisons, efficiency usually refers to attaining the relevant Fisher-information bound as sample size grows.
Neither term means “the estimate is accurate on this dataset.”
For the bivariate Gaussian model with unknown means and variances, sample correlation is the maximum-likelihood estimator of population correlation when the sample covariance is positive definite, and is asymptotically efficient at interior parameter values. The corresponding full-matrix statement also requires a full-rank sample covariance. Maximum-likelihood covariance uses denominator n rather than n − 1, but that common multiplier cancels when normalized to correlation.
Fixing means or variances as known changes the statistical model and can change the efficient procedure. Heavy tails, contamination or serial dependence also change the comparison. There is no universal efficiency ranking across all distributions.
Pearson, Spearman and Kendall usually estimate different population quantities. To compare their efficiency for one common parameter, first specify a model linking those quantities and transform the estimators to that shared target. Studies such as Dürre, Vogel and Fried make this dependence on model and robustness assumptions explicit.
Many variables make estimation harder
Even under independent Gaussian variables, a sample matrix has nonzero off-diagonal entries and a spread of eigenvalues. A population identity matrix does not produce an observed identity matrix.
In the classical independent, unit-variance random-matrix setting, when p/n approaches a positive ratio q, the limiting sample-covariance spectrum has edges
\[\lambda_-=(1-\sqrt q)^2, \qquad \lambda_+=(1+\sqrt q)^2.\]For q = 80/252, these are about 0.191 and 2.444. This is an asymptotic reference under a specific null model, not an exact finite-sample interval for every eigenvalue. When q > 1, a mass of zero eigenvalues also appears. The underlying result is the Marchenko–Pastur law.
Large or small empirical eigenvalues therefore need interpretation relative to sampling conditions. Inversion can amplify errors in the smallest estimated eigenvalues.
One simple regularization is
\[\widehat R_\alpha=(1-\alpha)\widehat R+\alpha I, \qquad 0<\alpha\leq1.\]Its eigenvalues are (1 − α)λᵢ + α, so it is positive definite and better conditioned. It introduces bias toward the identity. The purpose is to reduce overall estimation or downstream decision error, rather than to preserve unbiasedness. Ledoit and Wolf developed data-driven covariance shrinkage methods; the best target and intensity depend on the problem.
Missing observations and time series need their own treatment
The Gram proof assumes one common data matrix. If each pair uses a different subset of observations, there may be no common set of standardized vectors behind the assembled numbers. Pairwise deletion can therefore produce an indefinite matrix. This is documented explicitly in R’s covariance and correlation routines.
Financial returns also bring unequal trading calendars, stale prices, changing volatilities and heavy tails. Brain and climate time series have their own temporal dependence. Adjacent rolling windows share observations, so thousands of matrices need not represent thousands of independent experiments.
Longer windows can reduce sampling variability while mixing different states of a changing system. Choosing a window is therefore also choosing what population or local-in-time quantity we intend to estimate. Uncertainty calculations need a model or resampling procedure that respects the dependence in the observations.
Correlations copulas and joint dependence
Separating marginal distributions from dependence
For continuous marginal CDFs F₁, …, Fₚ, Sklar’s theorem writes the joint CDF as
\[F(x_1,\ldots,x_p) =C(F_1(x_1),\ldots,F_p(x_p)).\]The copula C is the joint distribution function of the marginal percentiles Uᵢ = Fᵢ(Xᵢ). Each Uᵢ is uniform on [0, 1]. The copula is unique for continuous margins. With discrete margins, uniqueness holds only on the relevant ranges of the marginal CDFs, and extensions require care.
This construction lets us distinguish changing the marginal distributions from changing how their percentile positions move together. The earlier empirical copula sampling experiments used this separation directly.
Spearman correlation and Kendall’s τ depend only on the bivariate copula when margins are continuous. Pearson correlation generally depends on the margins as well. Applying an increasing nonlinear transformation to a variable leaves the copula unchanged but can change its Pearson correlations.
The Gaussian copula and its correlation parameter
Start with a jointly Gaussian vector G with unit variances and correlation matrix Q, then set Uᵢ = Φ(Gᵢ). This defines the Gaussian copula. Other continuous margins can be attached by setting Xᵢ = Fᵢ⁻¹(Uᵢ).
The latent Gaussian matrix Q determines this copula. It is not generally the Pearson correlation matrix of the resulting X variables.
For a bivariate Gaussian copula with latent coefficient q,
\[\tau=\frac{2}{\pi}\arcsin(q), \qquad \rho_S=\frac{6}{\pi}\arcsin(q/2).\]These are different numbers describing the same copula. For q = 0.5, Kendall’s τ is 1/3 and Spearman correlation is approximately 0.483.
This also explains a common estimation procedure: estimate Kendall’s τ, then invert the Gaussian relationship to estimate q. In a large matrix, entrywise inversion does not automatically preserve positive semidefiniteness. Estimating compatible scalar coefficients and estimating a compatible multivariate copula parameter are separate steps.
The Student t copula shares the displayed Kendall relationship, but its Spearman relationship is not generally the Gaussian formula. The copula package documentation distinguishes these calibration formulas.
The same correlation can hide different tails
Take a Gaussian copula and a Student t copula with the same latent matrix Q and four degrees of freedom for the latter. If we use the corresponding Gaussian and Student t margins, both distributions have Pearson correlation q; they also have the same Kendall τ.
Their extreme co-movements differ. Define upper-tail dependence by
\[\lambda_U =\lim_{u\uparrow1}\mathbb P(U_2>u\mid U_1>u),\]when the limit exists. For a Gaussian copula with −1 < q < 1, this limit is zero. For the Student t copula,
\[\lambda_U =2T_{\nu+1}\left( -\sqrt{\frac{(\nu+1)(1-q)}{1+q}} \right),\]where T is the univariate Student t CDF. At q = 0.5 and ν = 4, the limit is approximately 0.253. See Demarta and McNeil.
Zero asymptotic tail dependence does not mean that joint large observations never occur. It describes how their conditional probability behaves as the threshold becomes increasingly extreme. At a fixed threshold, that conditional probability can still be substantial.
16,000 synthetic draws from each copula, with latent coefficient 0.5 and four degrees of freedom for the Student t case. Both have theoretical Kendall τ = 1/3. Orange lines mark the 95th percentiles; finite-threshold co-exceedances and the limiting tail coefficient are different quantities.
The Student t construction divides Gaussian components by a shared random scale. This supplies another route for extreme observations to occur together. Copulas remain defined even for Student distributions whose variances do not exist; Pearson correlation then ceases to be available for those margins.
The 2017 tail-dependence notes collect earlier references to this estimation problem.
Even all pairwise copulas do not specify the whole joint law
Here is a useful three-variable example. Let U and V be independent uniforms and set
\[W=(U+V)\bmod1.\]For each fixed U, adding U modulo one sends uniform V to another uniform variable. Thus U and W are independent. The same reasoning gives independence of V and W, and U and V were independent by construction.
Every pair has the independence copula and all three correlation matrices are identity matrices. But the triple is not jointly independent: U and V determine W exactly. Even perfect knowledge of every bivariate relationship can miss a genuinely multivariate dependence.
A general multivariate copula contains much more information than a matrix of pairwise coefficients.
An information theoretic angle
When a copula has a density c, the Kullback–Leibler divergence from independence is
\[\int_{[0,1]^p}c(u)\log c(u)\,du.\]For two variables this is their mutual information; for p variables it is often called total correlation. It measures a broader form of dependence than a single correlation coefficient, although estimating it is its own statistical problem. Singular copulas need a measure-theoretic treatment rather than a density formula.
For a nondegenerate Gaussian vector with correlation matrix R, total correlation reduces to
\[-\frac12\log\det R.\]This gives the determinant an information-theoretic interpretation within the Gaussian model. It does not make that formula a general dependence measure for arbitrary distributions. My copula-entropy discussion and optimal-transport dependence experiments explored related alternatives.
Structured correlation models worth knowing
A useful model specifies relationships among many entries at once. This can encode scientific assumptions, reduce estimation error, or supply controlled examples. The matrix pattern and the probability distribution of the observations are separate choices.
Equicorrelation and its exact parameter range
Let every off-diagonal entry equal r:
\[R=(1-r)I+r\mathbf1\mathbf1^\top.\]The all-ones vector is an eigenvector with eigenvalue 1 + (p − 1)r. Every vector orthogonal to it has eigenvalue 1 − r. Thus, for p ≥ 2,
\[-\frac1{p-1}\leq r\leq1\]is necessary and sufficient for positive semidefiniteness. Strict inequalities give positive definiteness.
This is another short exercise with a useful consequence: as dimension grows, the common negative correlation cannot stay strongly negative. For 100 variables the lower bound is approximately −0.0101.
For 0 ≤ r ≤ 1, one construction is
\[Z_i=\sqrt r\,F+\sqrt{1-r}\,\varepsilon_i,\]where the common factor F and the idiosyncratic noises are mutually independent, centered and unit variance. The negative part of the allowed range needs a different construction; it cannot be represented by the square-root formula above.
At the lower boundary the sum of the standardized variables has variance zero. Its negative common correlations exactly cancel aggregate variation.
Factor models
A more flexible covariance model is
\[X=BF+\varepsilon,\qquad \operatorname{Cov}(F)=\Omega,\qquad \operatorname{Cov}(\varepsilon)=\Psi,\qquad \Sigma=B\Omega B^\top+\Psi,\]assuming factors and residuals are uncorrelated. Positive semidefinite Ω and Ψ guarantee a positive semidefinite covariance matrix; positive-definite residual covariance ensures positive definiteness. Diagonal normalization gives a correlation matrix.
A market factor produces broad co-movement. Sector factors add block structure. Residual covariance allows variation not explained by those factors. A low-rank factor contribution does not force a low-rank full matrix when residual noise has positive variance.
PCA supplies statistical factor directions, but factors inferred from the sample can be noisy. The PCA return experiments are an earlier practical example.
Hierarchical blocks from nested factors
To construct a hierarchy, associate an independent centered unit-variance factor Fᵥ with each internal node of a tree. Let qᵥ ≥ 0 be its variance contribution. For each leaf i, let path(i) contain its ancestors and assume their contributions sum to at most one. Define
\[Z_i= \sum_{v\in\operatorname{path}(i)}\sqrt{q_v}\,F_v +\sqrt{1-\sum_{v\in\operatorname{path}(i)}q_v}\,\varepsilon_i.\]Use independent unit-variance residuals εᵢ. Each variable has variance one, and for distinct leaves,
\[R_{ij} =\sum_{v\in\operatorname{path}(i)\cap\operatorname{path}(j)}q_v.\]The proof is simply expanding covariance: only shared independent factors survive.
For example, assign 0.10 to a global factor, 0.25 to a sector factor and 0.25 to a subsector factor, with residual variance 0.40. Correlations are then 0.60 within a subsector, 0.35 between subsectors in one sector, and 0.10 across sectors. The matrix is valid by construction.
This gives an exact nested block model. Reordering its rows and columns can expose or hide the pattern, while leaving its eigenvalues unchanged. A clustering algorithm can produce a tree for much less structured data too; obtaining a dendrogram does not establish that the data follow this exact model.
The 2018 hierarchical-block portfolio simulations and 2020 Hierarchical PCA implementation explored related constructions and uses.
Other structures encode different assumptions
| Model | What determines the entries | Useful interpretation |
|---|---|---|
| AR(1) or exponential Toeplitz | Rᵢⱼ = φ raised to the distance between ordered indices, with absolute φ less than one | Correlation across time lags or an ordered array |
| Spatial kernel | A positive-semidefinite kernel evaluated at locations, normalized to unit diagonal | Correlation tied to physical distance and spatial scale |
| Sparse precision | A positive-definite inverse covariance with many zero off-diagonal entries | A sparse graph of conditional independences under a Gaussian model |
| Dynamic conditional correlation | A positive-semidefinite matrix evolves over time and is normalized to unit diagonal | Conditional relationships change with past observations |
| Low-rank plus residual noise | A few shared factors together with idiosyncratic variation | Common modes and a well-conditioned full covariance |
The AR(1) example can be derived from a stationary recursion
\[Z_t=\phi Z_{t-1}+\sqrt{1-\phi^2}\,\varepsilon_t, \qquad |\phi|<1.\]With independent unit-variance innovations and stationary unit variance, correlations satisfy Corr(Zₜ, Zₜ₊ₖ) = φ raised to the absolute value of k. The indices now have a temporal meaning. An arbitrary reordering must carry those time labels with it.
In a spatial model, decreasing correlation with distance is not by itself a validity proof. The chosen kernel must be positive semidefinite on the location configurations where it will be used.
Four 24-variable population examples. Equicorrelation is 0.25. The nested model uses global, sector and subsector contributions 0.10, 0.25 and 0.25, plus residual variance 0.40. The temporal model uses φ = 0.7.
A probability distribution over matrices
A fixed factor or block model specifies a matrix or a constrained family of matrices. Bayesian inference can also place a probability distribution over possible correlation matrices.
The LKJ family, for η > 0, has density
\[\pi(R)\propto(\det R)^{\eta-1}\]on positive-definite correlation matrices, relative to ordinary volume in the free off-diagonal coordinates. At η = 1 this density is constant over the elliptope interior. In dimensions above two, this does not make the entries independent or individually uniform. For η > 1 it favors larger determinants; for η < 1 it favors the low-determinant part of the domain.
This is the setting of the vine and extended onion constructions, with implementation details in the Stan documentation. My 2018 onion-method post illustrated uniform sampling. A distribution over mathematically valid matrices is a starting assumption; fitting the distribution to a particular domain is an additional modeling step.
What changes across applications
The algebraic constraints recur, but the variables, observations and scientific target can be very different.
| Field | Variables and observations | A central question |
|---|---|---|
| Quantitative finance | Assets or trading signals observed through time | How do common factors, changing volatilities and estimation error affect portfolio risk |
| Brain connectivity | Regional BOLD signals observed through time for each scan | Which associations survive preprocessing, temporal dependence and changes of subject or acquisition site |
| Gene co-expression | Gene measurements across biological samples | Which groups co-vary after accounting for batch effects, confounding and the experimental design |
| Radar and sensor arrays | Often complex-valued sensor signals measured across snapshots | How can structure and limited or missing data support stable beamforming and source detection |
| Climate and spatial data | Locations or stations observed across dates | How should seasonality, spatial scale and temporal persistence enter the dependence model |
| Forecast combination | Predictions or forecast errors across evaluation occasions | Which predictors contribute information beyond shared errors and redundant signals |
For brain data, correlation-based functional connectivity describes statistical association between measured signals. It does not directly identify anatomical connections or causal influence. Smith and colleagues compare network estimation approaches for fMRI. In gene expression, Langfelder and Horvath’s WGCNA builds weighted co-expression networks; transformed network edge weights need not themselves form a correlation matrix.
Radar also changes the underlying algebra. For complex signals, covariance uses conjugate transpose, so the matrix is Hermitian positive semidefinite, with real nonnegative diagonal and potentially complex off-diagonal entries. Normalized off-diagonal magnitudes are bounded by one and can retain phase information. Additional second-order quantities may be needed for improper complex signals. Aubry and colleagues study structured covariance estimation with missing radar data.
Some applications care about anonymous structure, such as the distribution of eigenvalues or block sizes. Others require the matrix to remain attached to named assets, brain regions, sensors or locations. The labels can be part of the scientific problem even when row order is arbitrary.
Forecasts provide another example of dependence in a decision problem: the copula forecast-combination series studies how shared information and error dependence enter a combined prediction.
These applications motivate additional viewpoints. Numerical linear algebra asks whether inversion and factorization are stable. Network analysis asks what information is retained by a graph or a clustering. Information geometry asks which transformations and distances reflect the task. Experimental design asks what one independent observation actually is. Those choices determine how the mathematical object should be estimated and used.
A small calculation to keep nearby
The core algebra can be checked with a few lines of NumPy:
import numpy as np
R = np.array([
[1.0, 0.9, 0.9],
[0.9, 1.0, -0.9],
[0.9, -0.9, 1.0],
])
w = np.array([-1.0, 1.0, 1.0])
print(np.linalg.eigvalsh(R)) # [-0.8, 1.9, 1.9]
print(w @ R @ w) # -2.4
rng = np.random.default_rng(42)
X = rng.standard_normal((40, 60))
R_hat = np.corrcoef(X, rowvar=False)
print(np.linalg.matrix_rank(R_hat)) # 39, up to numerical tolerance
alpha = 0.2
R_shrunk = (1 - alpha) * R_hat + alpha * np.eye(60)
print(np.linalg.eigvalsh(R_shrunk).min()) # approximately 0.2
The first calculation rejects an impossible set of pairwise correlations. The second produces a valid but singular estimate from too few observations. The third restores positive definiteness through a specified modeling choice.
All four illustrations in this article use synthetic examples with explicitly chosen population models. Their purpose is to isolate a mathematical or statistical effect without mixing it with data cleaning or a changing empirical system.
The next article will use these foundations to examine correlation-matrix generation: how a model can respect the matrix constraints while learning the distribution of structures seen in data.



