Tutorials › Multivariate Statistics (Graduate) › Common Errors In Covariance Hypothesis Tests

Covariance Matrix Inference · Tutorial 259 of 975

Common Errors In Covariance Hypothesis Tests

Recognize and correct the most common conceptual and computational errors in multivariate covariance hypothesis tests.

Intermediate 10 min read

What You'll Learn

  • Distinguish equality of covariance matrices from equality of correlation matrices
  • Identify when group-specific covariance estimates and a pooled estimate enter a test
  • Count degrees of freedom from the dimensions of the null and alternative models
  • Check determinant calculations and interpret determinant-based statistics
  • State the conditions needed for a chi-square approximation

Why Covariance-Test Errors Are Easy to Make

Multivariate covariance tests combine several kinds of reasoning: the hypothesis concerns a matrix, the statistic often depends on determinants, and its reference distribution depends on model assumptions. A calculation can look plausible while answering the wrong question. In particular, equal correlations do not require equal covariances, a pooled estimate is not a substitute for each group’s estimate, and the degrees of freedom are not simply the number of variables.

Let \(p\) be the number of variables and \(g\) the number of independent groups. For group \(i\), write \(n_i\) for its sample size, \(S_i\) for its usual unbiased sample covariance matrix, and \(N=\sum_{i=1}^g n_i\). The pooled within-group covariance estimate is

$$ S_p=\frac{\sum_{i=1}^g (n_i-1)S_i}{N-g}. $$

This estimate combines within-group scatter. It is useful in procedures whose model assumes a common covariance, but it does not describe the separate covariance estimates under a hypothesis that allows each group to have its own matrix.

Covariance Equality Is Not Correlation Equality

For a positive-definite covariance matrix \(\Sigma\), let \(D\) be the diagonal matrix of marginal standard deviations. Its correlation matrix is \(R=D^{-1}\Sigma D^{-1}\). The diagonal entries of \(\Sigma\) are variances; the off-diagonal entries are covariances. Correlations standardize those off-diagonal entries by the marginal standard deviations.

Definition: A covariance-equality hypothesis asserts \(\Sigma_1=\cdots=\Sigma_g\), including equality of every variance and covariance. A correlation-equality hypothesis asserts \(R_1=\cdots=R_g\); it does not require the groups to have the same marginal variances.

The distinction follows directly from the scaling relation. If \(D\) is positive diagonal, then

$$ \operatorname{Corr}(D\Sigma D)=\operatorname{Corr}(\Sigma), \qquad |D\Sigma D|=|D|^2|\Sigma|. $$

For the first identity, the diagonal standard-deviation matrix of \(D\Sigma D\) is \(D\) times the diagonal standard-deviation matrix of \(\Sigma\). Substitution in the definition of the correlation matrix cancels the factors of \(D\). For the second, use multiplicativity of the determinant: \(|D\Sigma D|=|D||\Sigma||D|\). Thus changing measurement scales can leave correlations unchanged while changing both covariances and determinants.

Worked Example: Equal Correlations but Unequal Covariances

Consider two population covariance matrices:

$$ \Sigma_1= \begin{pmatrix} 1&0.6\\ 0.6&4 \end{pmatrix}, \qquad \Sigma_2= \begin{pmatrix} 9&1.8\\ 1.8&4 \end{pmatrix}. $$

Both are positive definite: their diagonal entries are positive, and their determinants are \(4-0.6^2=3.64>0\) and \(36-1.8^2=32.76>0\). The first correlation is \(0.6/(\sqrt{1}\sqrt{4})=0.3\); the second is \(1.8/(\sqrt{9}\sqrt{4})=1.8/6=0.3\). Their correlation matrices are equal, but their variances and covariances differ, so \(\Sigma_1\ne\Sigma_2\).

A test of equal correlations would treat this pair as satisfying its population null, whereas a test of equal covariance matrices would not. Replacing one null by the other changes the scientific claim, not merely the calculation.

This scaling also explains a common determinant error. A determinant is scale-dependent: it changes when variables are measured in different units. Consequently, a determinant calculation based on raw covariance matrices cannot automatically be interpreted as a test of correlation equality. The hypothesis and the statistic must match.

Group-Specific Estimates and the Pooled Estimate

For the likelihood-ratio comparison of equal group covariance matrices with unrestricted group covariance matrices, the uncorrected Box’s \(M\) statistic is

$$ M=(N-g)\log|S_p|-\sum_{i=1}^g(n_i-1)\log|S_i|. $$

The pooled determinant and the group-specific determinants have different roles in this expression. Substituting \(S_p\) for every \(S_i\) erases the differences the statistic is meant to assess. Conversely, using an unweighted average of the \(S_i\) in place of \(S_p\) ignores the different within-group degrees of freedom. The weights are \(n_i-1\), not \(n_i\), because each group mean has been estimated.

Worked Example: Checking a Two-Group Determinant Calculation

Suppose \(p=2\), \(n_1=5\), \(n_2=7\), and

$$ S_1= \begin{pmatrix} 1&0\\ 0&4 \end{pmatrix}, \qquad S_2= \begin{pmatrix} 4&0\\ 0&1 \end{pmatrix}. $$

Here \(N=12\) and \(g=2\). The correctly weighted pooled estimate is

$$ S_p=\frac{4S_1+6S_2}{10} =\begin{pmatrix}2.8&0\\0&2.2\end{pmatrix}. $$

Therefore \(|S_1|=4\), \(|S_2|=4\), and \(|S_p|=2.8(2.2)=6.16\). Substitution gives

$$ M=10\log(6.16)-4\log(4)-6\log(4) =10\log(6.16/4) =10\log(1.54)\approx 4.318. $$

The two group determinants happen to be equal, but the matrices are not: the larger variance is in a different coordinate in each group. A determinant alone does not establish equality of covariance matrices. The determinant statistic combines the group-specific matrices with the pooled estimate; it is not a comparison of determinants interpreted in isolation.

Result: For positive-definite \(S_i\), \(M\geq 0\). The function \(A\mapsto\log|A|\) is concave on positive-definite matrices, so applying its concavity to the weighted average \(S_p=\sum_i w_iS_i\), where \(w_i=(n_i-1)/(N-g)\), gives \(\log|S_p|\geq\sum_i w_i\log|S_i|\). Multiplying by \(N-g\) yields the stated inequality.

A negative value beyond numerical rounding is therefore a warning to check the weights, group degrees of freedom, determinant calculations, and whether each matrix is positive definite. When a sample covariance matrix is singular, its log determinant is not finite, so the usual determinant-based calculation cannot be carried out as written.

Count Degrees of Freedom From the Restrictions

A frequent mistake is to use \(p\), or the number of off-diagonal entries, as the degrees of freedom for every covariance test. The appropriate count is the difference in the number of free parameters in the alternative and null models, provided the models are regular and the restrictions are locally independent.

Result: A symmetric \(p\times p\) covariance matrix has \(m=p(p+1)/2\) free parameters: \(p\) variances and \(p(p-1)/2\) distinct covariances. Under regular likelihood-ratio conditions, the asymptotic chi-square degrees of freedom equal the alternative dimension minus the null dimension.

For equality of \(g\) unrestricted covariance matrices, the alternative has \(gm\) parameters and the common-covariance null has \(m\). The difference is \((g-1)p(p+1)/2\), which is the usual chi-square degrees of freedom for the likelihood-ratio comparison. For equality of correlation matrices with group-specific variances, each correlation matrix has \(q=p(p-1)/2\) free correlations. The alternative has \(g(p+q)\) parameters; the null has \(gp+q\), since variances remain group-specific but correlations are common. The difference is \((g-1)q\).

These counts are derived by listing the free parameters under each model and subtracting. They also show why the two hypotheses have different degrees of freedom: equality of covariance matrices restricts variances as well as correlations, while equality of correlation matrices does not.

Worked Example: Degrees of Freedom for Three Variables

Let \(p=3\). A symmetric covariance matrix has \(m=3(4)/2=6\) free entries: three variances and three distinct covariances. Its correlation matrix has \(q=3(2)/2=3\) free off-diagonal correlations.

For two groups, the equal-covariance null has \(6\) parameters, while the alternative with separate covariance matrices has \(12\). The difference, and hence the regular asymptotic chi-square degrees of freedom, is \(12-6=6\). For equal correlation matrices while allowing separate variances, the alternative has \(2(3+3)=12\) parameters and the null has \(2(3)+3=9\), giving \(12-9=3\) degrees of freedom.

For a single three-variable covariance matrix tested against a diagonal covariance matrix, the unrestricted model has \(6\) parameters and the diagonal model has \(3\). The difference is \(3\), corresponding to the three off-diagonal covariances constrained to zero. The answer depends on the stated null; “three variables” by itself does not determine the degrees of freedom.

When a Chi-Square Approximation Is Justified

A chi-square reference distribution is not a consequence of writing down a likelihood-ratio statistic. Wilks’ theorem supplies the usual asymptotic calibration under regularity conditions. In this setting, the basic conditions include independent observations within and across groups, multivariate normal sampling for the classical covariance likelihood, positive-definite population covariance matrices, fixed \(p\) and \(g\), and sample sizes that grow so the null and alternative parameters are identifiable. The null restrictions must be smooth and locally independent, and the true parameter must be an interior point of the parameter space.

Under these conditions, the likelihood-ratio statistic, expressed on the usual \(-2\log\)-likelihood scale, converges in distribution under the null to a chi-square random variable with degrees of freedom given by the dimension difference. For Box’s \(M\), a finite-sample correction is commonly applied to improve the approximation; the corrected statistic and its calibration should not be confused with the uncorrected \(M\) value. The specific approximation may still be poor for small samples, especially when dimension is large relative to group sizes.

Normality matters because the classical likelihood and its chi-square calibration are derived under a distributional model, not simply from the fact that \(S_i\) are sample covariance matrices. Strong nonnormality, influential observations, dependence, near-singular estimates, or dimensions that increase with sample size can undermine the approximation. A chi-square result should therefore be reported as an approximation whose conditions have been assessed, not as an exact finite-sample fact.

Common Mistakes and Corrections

  • Wrong: “The groups have equal correlations, so they have equal covariance matrices.” Correction: Equal correlations permit group-specific marginal variances. State which matrix is under test.
  • Wrong: “The pooled covariance is the estimate for each group under the alternative.” Correction: The pooled estimate represents a common within-group covariance; the separate \(S_i\) retain the group-specific information.
  • Wrong: “The degrees of freedom are \(p\).” Correction: Count free parameters in the specified alternative and null, then take their difference under regularity conditions.
  • Wrong: “Equal determinants mean equal covariance matrices.” Correction: A determinant is one scalar summary. Different matrices can have the same determinant, as the worked example illustrates.
  • Wrong: “Every likelihood-ratio statistic has an exact chi-square distribution.” Correction: The familiar chi-square calibration is generally asymptotic and depends on model and regularity assumptions.
  • Wrong: “A negative Box’s \(M\) value is just a possible sampling outcome.” Correction: With positive-definite inputs and the stated formula, concavity of log determinant implies \(M\geq0\); check the computation or matrix inputs.
Key takeaway: Before interpreting a covariance-test result, write the null in words and symbols, identify which matrices are group-specific or pooled, count the restrictions, verify the determinants, and check whether the approximation’s assumptions are credible.

Check Your Understanding

Use the definitions and calculations above to answer the following.

  1. Can two groups have equal correlation matrices but unequal covariance matrices? Explain what may differ between them.
  2. Why does the pooled covariance use weights \(n_i-1\) rather than equal weights?
  3. For two groups and \(p=4\), calculate the regular asymptotic degrees of freedom for testing equality of unrestricted covariance matrices.
  4. Why does equality of determinants not establish equality of covariance matrices?
  5. Name two conditions or data features that can make a chi-square calibration unreliable.
Clinical Biostats