Why Pairwise Covariances Need Not Fit Together
When subjects have different modalities available, each pair of variables may be observed on a different subset. Calculating a covariance separately for each available pair can retain more observations than restricting every calculation to subjects with all variables observed. But the resulting estimates do not necessarily behave like entries of one covariance matrix from one joint sample. In particular, the assembled matrix can fail to be positive semidefinite, a necessary property of any genuine covariance matrix.
This is not merely a technical issue. A covariance matrix that fails this condition cannot describe the variances of all linear combinations of the variables. It can therefore give impossible results in methods that treat the assembled estimates as a coherent joint covariance structure.
The pair-specific means in this definition matter: for \(s_{jk}^{(pair)}\), both variables are centered using the subjects in \(S_{jk}\). The diagonal entry for variable \(j\), by contrast, typically uses every subject with \(X_j\) observed. Thus even an off-diagonal entry and its corresponding diagonal entries can be based on different subsets. Pairwise-complete correlations are calculated analogously, with each pair’s covariance divided by the pair-specific sample standard deviations.
The Required Matrix Property
A real symmetric matrix \(C\) is positive semidefinite if \(a^\mathsf{T}Ca\geq 0\) for every vector \(a\) of compatible length. For a covariance matrix, \(a^\mathsf{T}Ca\) is the variance of a linear combination of the variables. A variance cannot be negative, so every covariance matrix must be positive semidefinite. A correlation matrix must have this property too.
With complete observations on the same \(n\) subjects for all \(p\) variables, this requirement follows directly from the sample covariance formula. Let \(Z\) be the \(n\) by \(p\) matrix of observations after subtracting each column’s sample mean. The sample covariance matrix is \(C=Z^\mathsf{T}Z/(n-1)\). For any vector \(a\),
The same subjects and centering convention are used throughout this calculation. With pairwise-complete estimates, there may be no single centered data matrix \(Z\) that generates all the entries. The algebraic guarantee therefore does not apply. Individual pairwise calculations can be valid for their own subsets while the assembled matrix is not a valid joint covariance matrix.
Worked Example: Three Pairwise Subsets Produce a Negative Variance
Suppose a hypothetical study measures three omics features, \(A\), \(B\), and \(C\), in six subjects. Each subject has exactly two observed features, and the observed values are as follows.
| Subjects | Observed pair | First subject | Second subject |
|---|---|---|---|
| 1–2 | \(A,B\) | \(A=-1,\ B=-1\) | \(A=1,\ B=1\) |
| 3–4 | \(A,C\) | \(A=-1,\ C=-1\) | \(A=1,\ C=1\) |
| 5–6 | \(B,C\) | \(B=-1,\ C=1\) | \(B=1,\ C=-1\) |
Each feature has four observed values, two at \(-1\) and two at \(1\). Its mean is \(0\), and its available-data sample variance is $$ s_A^2=s_B^2=s_C^2=\frac{(-1)^2+1^2+(-1)^2+1^2}{4-1}=\frac{4}{3}. $$ For subjects 1–2, the pair means are both 0, so \(s_{AB}^{(pair)}=[(-1)(-1)+(1)(1)]/(2-1)=2\). For subjects 3–4, the same calculation gives \(s_{AC}^{(pair)}=2\). For subjects 5–6, it gives \(s_{BC}^{(pair)}=[(-1)(1)+(1)(-1)]/(2-1)=-2\). The assembled covariance matrix is therefore $$ C_{pair} = \begin{pmatrix} 4/3 & 2 & 2 \\ 2 & 4/3 & -2 \\ 2 & -2 & 4/3 \end{pmatrix}. $$ Take \(a=(1,-1,-1)^\mathsf{T}\). Direct calculation gives \(a^\mathsf{T}C_{pair}a=4-12=-8\). This matrix is not positive semidefinite: it would imply that the linear combination \(A-B-C\) has variance \(-8\), which is impossible. Each pairwise covariance was calculated correctly for its two subjects; the contradiction arises when the three estimates are assembled as if they came from one common sample.
Correlation Checks and What They Reveal
A simple three-variable correlation check makes the inconsistency visible on a familiar scale. In the example above, each pair has perfect correlation in its own two-subject subset: \(r_{AB}=1\), \(r_{AC}=1\), and \(r_{BC}=-1\). Assembling those estimates gives
For \(a=(1,-1,-1)^\mathsf{T}\), \(a^\mathsf{T}R_{pair}a=3-6=-3\), again contradicting positive semidefiniteness. The pairwise correlations are individually within the allowed range from \(-1\) to \(1\), but that range check alone is insufficient: the correlations must also be mutually compatible.
The full three-variable condition is that the determinant of a correlation matrix with correlations \(r_{12}\), \(r_{13}\), and \(r_{23}\) must satisfy
For the example, this is \(1+2(1)(1)(-1)-1-1-1=-4\), so the condition fails. This check is useful for three variables, but larger matrices require checking positive semidefiniteness of the whole matrix, not just the range of individual correlations.
Worked Example: Checking Three Pairwise Correlations
Suppose a hypothetical set of pairwise-complete estimates gives \(r_{AB}=0.8\), \(r_{AC}=0.8\), and \(r_{BC}=-0.8\). Each estimate lies between \(-1\) and \(1\), so each is a permissible correlation in isolation. For the assembled three-variable correlation matrix, however, $$ \det(R)=1+2(0.8)(0.8)(-0.8)-(0.8)^2-(0.8)^2-(-0.8)^2 =1-1.024-1.92=-1.944. $$ A negative determinant rules out positive semidefiniteness. These three estimates cannot all be correlations from one common joint distribution or one common sample, even though each pairwise estimate is individually in range. This check diagnoses incompatibility; it does not identify which pair estimate is inaccurate.
What Pairwise Estimates Do—and Do Not—Guarantee
If the variables have a well-defined common target population with finite second moments, its population covariance matrix is positive semidefinite. Under suitable sampling and missingness conditions, each pairwise-complete estimate may target the corresponding population covariance. For example, if subjects are sampled from the same population and pair availability is independent of the measured values, the observed pair can represent that population. Even then, finite-sample estimates from different subsets can assemble into a non-positive-semidefinite matrix. Sampling variability does not preserve all the joint constraints among covariance entries.
If availability depends on measured values, pair-specific subsets may instead represent different parts of the population. The pairwise estimates can then target different conditional covariances, rather than the entries of one common population covariance matrix. A positive-semidefinite result does not prove that the missingness assumptions are appropriate or that all estimates describe the same target population. The earlier material on MCAR, MAR, and MNAR addresses the distinct question of how missingness relates to observed and unobserved values.
Pairwise deletion can use more observations for each individual association than complete-case analysis, especially when few subjects have every modality. But it sacrifices the common-sample structure that guarantees a valid sample covariance matrix. Complete-case analysis uses a shared set of subjects for all entries and therefore produces a positive-semidefinite sample covariance matrix when the estimates are defined. It may use substantially fewer subjects, and its results can be unrepresentative if complete-case status is related to the data. Neither choice automatically resolves the consequences of missingness.
Worked Example: A Common Sample Gives a Coherent Matrix
For contrast, suppose a hypothetical study observes all three features on the same three subjects:
| Subject | \(A\) | \(B\) | \(C\) |
|---|---|---|---|
| 1 | 0 | 0 | 2 |
| 2 | 1 | 1 | 1 |
| 3 | 2 | 2 | 0 |
All three sample means are 1. The centered values for \(A\) and \(B\) are \((-1,0,1)\), and those for \(C\) are \((1,0,-1)\). With \(n=3\), each sample variance is \(2/(3-1)=1\), the sample covariance of \(A\) and \(B\) is \(2/(3-1)=1\), and the covariances of \(A,C\) and \(B,C\) are each \(-2/(3-1)=-1\). Thus $$ C = \begin{pmatrix} 1 & 1 & -1 \\ 1 & 1 & -1 \\ -1 & -1 & 1 \end{pmatrix}. $$ This is \(uu^\mathsf{T}\) for \(u=(1,1,-1)^\mathsf{T}\). Therefore \(a^\mathsf{T}Ca=(u^\mathsf{T}a)^2\geq0\) for every \(a\). Its determinant is zero, which is permitted: positive semidefinite matrices may be singular. Here all entries come from the same subjects, so the shared-sample guarantee applies.
Diagnostics, Alternatives, and Limitations
Before using a pairwise-complete matrix in a multivariate method, check how it was assembled and whether its entries satisfy the properties required by that method. Useful diagnostics include:
- Record \(n_{jk}\) for every pair. Very small or highly unequal overlaps warn that estimates may be noisy or represent different subject subsets.
- Check symmetry, finite values, and nonnegative diagonal entries. These are necessary checks, but they do not establish positive semidefiniteness.
- For a correlation matrix, verify that each entry lies in \([-1,1]\), then check the eigenvalues or use a numerical positive-semidefinite check. Small negative eigenvalues may reflect rounding; substantial negative eigenvalues indicate material incompatibility.
- Compare pairwise estimates with estimates based on a shared subject set, where feasible. Differences can reflect both changed sample size and changed subject composition.
A common mistake is to argue, “Every pairwise correlation is between \(-1\) and \(1\), so the correlation matrix is valid.” The worked example disproves that reasoning: all three correlations are at the endpoints, yet the determinant is negative. The correction is to check the matrix-level constraint, including positive semidefiniteness. Another mistake is to assume that a positive-semidefinite pairwise matrix proves the pair estimates came from one coherent sample. It does not; the check rules out one kind of incompatibility but cannot recover common subjects or establish a missingness mechanism.
The main alternative considered here is complete-case covariance: it preserves a common sample and the positive-semidefinite guarantee, at the cost of discarding subjects missing any required variable. Pairwise deletion retains more pair-specific data but can produce an incoherent matrix and can mix subsets with different compositions. The appropriate choice depends on the estimand, missingness, and downstream requirements; simply replacing negative eigenvalues after the fact changes the estimates and does not address why the incompatibility arose. Pairwise estimates should therefore be reported with their overlap counts and their matrix properties, not treated as automatically interchangeable with a covariance matrix computed from one shared sample.
Check Your Understanding
Use the definitions and calculations in this tutorial to answer the questions. Brief solutions follow.
- Why must any covariance matrix be positive semidefinite?
- A pairwise-complete correlation matrix has \(r_{12}=0.6\), \(r_{13}=0.6\), and \(r_{23}=-0.6\). Calculate its determinant and state what it implies.
- Can every entry of a correlation matrix be within \([-1,1]\) while the matrix is not positive semidefinite? Explain briefly.
- Why does calculating all covariances on the same complete cases guarantee a positive-semidefinite sample covariance matrix?
Solutions. 1. For any vector \(a\), \(a^\mathsf{T}Ca\) is the variance of a linear combination and cannot be negative. 2. The determinant is \(1+2(0.6)(0.6)(-0.6)-3(0.6)^2=1-0.432-1.08=-0.512\); the matrix is not positive semidefinite. 3. Yes. The range restriction checks entries separately, not their joint compatibility; the negative determinant in question 2 is an example. 4. With one centered data matrix \(Z\), the sample covariance is \(Z^\mathsf{T}Z/(n-1)\), so its quadratic form is a sum of squares divided by \(n-1\) and is nonnegative.