Why Unequal Group Sizes Matter
Box’s M tests whether several independent multivariate groups share a covariance matrix. When group sizes differ, each group does not contribute equally to the pooled covariance: a covariance estimated from many residual degrees of freedom receives more weight than one estimated from few. The finite-sample correction also depends on each group’s residual degrees of freedom, so replacing unequal sample sizes by an average can change both the pooled matrix and the test statistic.
Suppose there are \(g\) independent groups, each measured on \(p\) variables. Group \(i\) has sample size \(n_i\), sample mean vector \(\bar X_i\), and unbiased sample covariance matrix \(S_i\). Write \(N=\sum_{i=1}^g n_i\). Assume multivariate normal sampling with positive-definite covariance matrices, and suppose each \(n_i>p\), so the sample covariance matrices are positive definite with probability one. The null hypothesis is that all groups have one common covariance matrix; their mean vectors may differ.
Thus the pooled covariance is a degrees-of-freedom-weighted average, not an unweighted average of the group matrices. The determinant terms compare the pooled covariance with each group covariance, with the same degrees-of-freedom weights. The log determinants are well-defined under the positive-definiteness conditions above.
The Correction and Chi-Square Calibration
The usual Box–M approximation applies a finite-sample correction to \(M\). It is an approximation to a chi-square reference distribution, not an exact finite-sample distribution. Define
The correction uses the reciprocal residual degrees of freedom of every group. A small group therefore contributes more to the correction than a large group. In particular, the bracket is not obtained by substituting an average sample size: it is calculated as \(\sum_i1/\nu_i-1/\nu\).
The degrees of freedom follow from counting covariance parameters. A symmetric \(p\times p\) covariance matrix has \(p(p+1)/2\) distinct entries. Under the alternative, there are \(g\) such matrices; under the null, there is one. The difference is \((g-1)p(p+1)/2\) restrictions. Wilks calibration motivates the chi-square reference, while the correction adjusts the statistic for finite sample sizes.
Why the Statistic Is Nonnegative
A useful check on any calculation is that \(M\) cannot be negative. The reason is concavity of the log determinant. The weights in the pooled covariance are exactly the weights needed to apply that concavity.
Proof. Set \(\alpha_i=\nu_i/\nu\). These weights are positive and sum to one, and \(S_p=\sum_i\alpha_iS_i\). For a positive-definite matrix \(A\) and a symmetric direction \(H\), differentiating along a line of positive-definite matrices gives $$ \frac{d^2}{dt^2}\log|A+tH| =-\operatorname{tr}\left((A+tH)^{-1}H(A+tH)^{-1}H\right)\leq 0. $$ The inequality holds because the trace equals the trace of the square of the symmetric matrix \((A+tH)^{-1/2}H(A+tH)^{-1/2}\), and a squared symmetric matrix has nonnegative trace. Hence \(\log|A|\) is concave on the positive-definite matrices. Jensen’s inequality gives $$ \log|S_p|\geq\sum_i\alpha_i\log|S_i|. $$ Multiplying by \(\nu\) gives \(M\geq0\). The log determinant is strictly concave, so equality holds precisely when all positively weighted matrices \(S_i\) are identical. \(\square\)
Worked Calculations
Worked Example: Pooling Unequal Group Variances
Three independent groups have sample sizes \(6,10,20\), and their sample variances for a single measurement are \(4,9,16\). Calculate the pooled variance.
The residual degrees of freedom are \(5,9,19\), for a total of \(33\). Therefore, $$ S_p=\frac{5(4)+9(9)+19(16)}{33} =\frac{20+81+304}{33} =\frac{405}{33} =\frac{135}{11}\approx12.273. $$ The largest group has the largest weight because it contributes 19 residual degrees of freedom. The unweighted average, \((4+9+16)/3\approx9.667\), is not the Box pooled variance for these unequal sample sizes.
Worked Example: A Three-Group Box’s M Test
Let \(p=2\), and suppose three groups have sizes \(10,15,25\) and sample covariance matrices $$ S_1=\begin{pmatrix}4&1\\1&2\end{pmatrix},\quad S_2=\begin{pmatrix}3&0\\0&3\end{pmatrix},\quad S_3=\begin{pmatrix}2&-0.5\\-0.5&4\end{pmatrix}. $$ Calculate the pooled covariance, \(M\), and its corrected chi-square approximation.
The residual degrees of freedom are \(9,14,24\), so \(\nu=47\). Pool each matrix entry using those weights: $$ S_p=\frac{9S_1+14S_2+24S_3}{47} =\begin{pmatrix}126/47&-3/47\\-3/47&156/47\end{pmatrix}. $$ Its determinant is $$ |S_p|=\frac{126(156)-9}{47^2}=\frac{19647}{2209}\approx8.8936. $$ The three group determinants are \(|S_1|=7\), \(|S_2|=9\), and \(|S_3|=2(4)-(-0.5)^2=7.75\). Substitution gives $$ M=47\log(8.8936)-9\log(7)-14\log(9)-24\log(7.75)\approx5.29. $$ For the correction, the factor outside the bracket is \(13/36\), since \(p=2\) and \(g=3\). The bracket is $$ \frac19+\frac1{14}+\frac1{24}-\frac1{47}\approx0.20293, $$ so \(C\approx(13/36)(0.20293)=0.07328\). The corrected statistic is \(M_c\approx(1-0.07328)(5.29)=4.90\). The reference degrees of freedom are \(2(2)(3)/2=6\); the approximate upper-tail probability is about \(0.56\). This calculation does not provide evidence against equality at conventional significance levels.
Worked Example: How Group Sizes Enter the Correction
Suppose three two-variable groups have sizes \(6,12,30\), with covariance matrices $$ S_1=\begin{pmatrix}1&0\\0&2\end{pmatrix},\quad S_2=\begin{pmatrix}2&0\\0&1\end{pmatrix},\quad S_3=\begin{pmatrix}1.5&0\\0&1.5\end{pmatrix}. $$ Work out the pooled determinant, \(M\), and correction, and note the influence of the largest group.
The residual degrees of freedom are \(5,11,29\), totaling \(45\). Thus $$ S_p=\begin{pmatrix}(5+22+43.5)/45&0\\0&(10+11+43.5)/45\end{pmatrix} =\begin{pmatrix}47/30&0\\0&43/30\end{pmatrix}, \qquad |S_p|=\frac{2021}{900}\approx2.24556. $$ Each of the first two covariance matrices has determinant \(2\); the third has determinant \(2.25\). Therefore, $$ M=16\log(2.24556/2)+29\log(2.24556/2.25)\approx1.796. $$ The correction bracket is $$ \frac15+\frac1{11}+\frac1{29}-\frac1{45}\approx0.30317. $$ With \(p=2\) and \(g=3\), \(C=(13/36)(0.30317)\approx0.10945\), giving \(M_c\approx1.599\). The chi-square degrees of freedom are 6. The group with 29 residual degrees of freedom dominates the pooled matrix, but its reciprocal contribution, \(1/29\), is smaller than either of the contributions from the two smaller groups. This illustrates the distinct roles of \(\nu_i\) in pooling and \(1/\nu_i\) in the correction.
A Useful Invariance Check
Box’s M does not depend on the units or the common linear coordinates used to measure the variables. To see this, transform every observation by the same nonsingular matrix \(A\). Each covariance matrix becomes \(AS_iA^\mathsf{T}\), and the pooled matrix becomes \(AS_pA^\mathsf{T}\). Its determinant is \(|A|^2|S_i|\), or \(|A|^2|S_p|\), respectively. Consequently, the extra log-determinant term in \(M\) is $$ \left(\nu-\sum_i\nu_i\right)\log|A|^2=0, $$ because \(\nu=\sum_i\nu_i\). Thus the statistic is unchanged. This is a practical diagnostic: converting a variable from one unit to another for every group should not change \(M\).
Common Mistakes and Interpretation
- Using an unweighted covariance average. The correct pooled matrix is \(\sum_i(n_i-1)S_i/(N-g)\), not \(\sum_iS_i/g\).
- Using \(n_i\) instead of \(n_i-1\). The group covariance matrices here are unbiased sample covariances; their weights are their residual degrees of freedom.
- Replacing the correction bracket by an average group size. Calculate every \(1/(n_i-1)\), then subtract \(1/(N-g)\).
- Calling the calibration exact. The corrected chi-square distribution is an approximation. It is not the exact finite-sample distribution of \(M\).
- Ignoring the model assumptions. The usual test is developed for independent multivariate normal groups and nonsingular covariance estimates. A numerical result alone does not establish those conditions.
When reporting the test, give the group sample sizes, the corrected statistic, its chi-square degrees of freedom, and the approximate \(p\)-value. Showing the residual degrees of freedom makes the unequal-size weighting transparent and helps others check the calculation.
Check Your Understanding
Use the definitions and calculations above to answer these questions.
- Three groups have sample sizes \(8,12,30\). What are their residual degrees of freedom, and what is the denominator of their pooled covariance?
- Why does a group with a larger sample size receive more weight in \(S_p\), but contribute less through its reciprocal term in the correction?
- For \(p=3\) and \(g=4\), how many chi-square degrees of freedom does the Box’s M approximation use?
- What condition on the group covariance matrices makes \(M=0\)?
- Why should changing all measurements from one unit system to another leave Box’s M unchanged?