Why Unequal Group Sizes Need Careful Weighting
In a repeated-measures study, every subject contributes a profile across the same measurement occasions. Often the scientific question is not whether the entire profile differs between treatment groups, but whether a particular within-subject feature—such as a change from baseline or a linear trend—differs between groups. A contrast matrix turns each subject’s profile into a vector of contrast responses, after which group means and covariance estimates can be compared.
Unequal group sizes do not prevent this analysis. They do matter: group means have different precision, the combined mean must use sample-size weights, and the pooled covariance must weight each group’s covariance by its residual degrees of freedom. The key is to use those weights while keeping the assumptions for inference visible.
The condition \(C\mathbf{1}_p=0\) makes each row a within-subject contrast: adding the same constant to every occasion does not change that contrast. The matrix may contain one planned contrast or a set of linearly independent contrasts. Write \(\bar z_g\) for the sample mean of the contrast responses in group \(g\), and \(S_g\) for their usual sample covariance matrix.
What Unequal Sizes Change—and What They Do Not
For comparisons of group contrast means, the common-covariance assumption is that every group has the same contrast-response covariance matrix, denoted \(\Sigma_C\). Under this assumption, the covariance of a group sample mean depends on its own sample size:
Thus a mean based on more subjects is more precise. The natural weighted grand mean is \(\bar z_w=\sum_g n_g\bar z_g/N\), where \(N=\sum_g n_g\). It is not generally the unweighted average of the group means.
The weights \(n_g-1\) arise because each \(S_g\) is calculated around its own estimated group mean and has \(n_g-1\) residual degrees of freedom. Equal group sizes are not needed for this estimator or for the weighted grand mean. Complete repeated-measures data do require that the same occasions and contrast definition be available for every subject included in the analysis.
Worked Example: Forming Contrast Responses From Profiles
Suppose profiles have three occasions, and the two contrasts are occasion 1 minus occasion 2 and occasion 2 minus occasion 3: $$ C=\begin{pmatrix}1&-1&0\\0&1&-1\end{pmatrix}. $$ Group A has 8 complete subjects and sample profile mean \((10,13,16)^\mathsf{T}\). Group B has 13 complete subjects and sample profile mean \((11,12,15)^\mathsf{T}\). Find the contrast-response means and their difference.
For group A, $$ \bar z_A=C\begin{pmatrix}10\\13\\16\end{pmatrix} =\begin{pmatrix}10-13\\13-16\end{pmatrix} =\begin{pmatrix}-3\\-3\end{pmatrix}. $$ For group B, $$ \bar z_B=C\begin{pmatrix}11\\12\\15\end{pmatrix} =\begin{pmatrix}11-12\\12-15\end{pmatrix} =\begin{pmatrix}-1\\-3\end{pmatrix}. $$ The estimated group difference, B minus A, is \(\bar z_B-\bar z_A=(2,0)^\mathsf{T}\). The first contrast differs by 2 units between groups, while the second estimated contrast is the same. The unequal counts affect the precision of this difference, not the calculation of either group’s contrast-response mean.
Two Results That Explain the Weights
The first result justifies pooling the within-group covariance estimates. Assume that subjects are independent within and across groups, that each group has covariance \(\Sigma_C\), and that the covariance matrices \(S_g\) are defined with denominator \(n_g-1\).
To see this, the usual sample covariance within group \(g\) is unbiased, so \(E[S_g]=\Sigma_C\). Taking expectations in the definition of \(S_p\) gives $$ E[S_p] =\frac{\sum_g(n_g-1)E[S_g]}{N-G} =\frac{\sum_g(n_g-1)\Sigma_C}{N-G} =\frac{N-G}{N-G}\Sigma_C =\Sigma_C. $$ This argument uses a common covariance across groups. If group covariances differ, the same calculation instead gives a weighted average of those covariances, not an estimate of one shared covariance. \(\square\)
The second result shows why the grand mean is weighted by group size. Assume independent subjects and a common group mean covariance \(\Sigma_C\).
Linearity of expectation gives \(E[\bar z_w]=\sum_g(n_g/N)m_g=m_w\). Independence across groups makes the covariance of the weighted sum the sum of the weighted covariances: $$ \operatorname{Var}(\bar z_w) =\sum_g\left(\frac{n_g}{N}\right)^2\operatorname{Var}(\bar Z_g) =\sum_g\left(\frac{n_g}{N}\right)^2\frac{\Sigma_C}{n_g} =\frac{\sum_g n_g}{N^2}\Sigma_C =\frac{\Sigma_C}{N}. $$ The unweighted average would not generally have this covariance or represent the mean over all sampled subjects when the group sizes differ. \(\square\)
Omnibus and Planned Group Comparisons
For an omnibus comparison of \(G\) groups, the null hypothesis is \(H_0:m_1=\cdots=m_G\). Define the between-group and within-group scatter matrices by $$ H=\sum_{g=1}^G n_g(\bar z_g-\bar z_w)(\bar z_g-\bar z_w)^\mathsf{T}, \qquad E=\sum_{g=1}^G(n_g-1)S_g. $$ The unequal sample sizes appear explicitly in \(H\); the pooled covariance is \(S_p=E/(N-G)\). For example, Wilks’ lambda is \(\Lambda=|E|/|E+H|\), when the determinants are defined. Under multivariate normality of the contrast responses, independent subjects, and a common positive-definite \(\Sigma_C\), this is the standard one-way MANOVA comparison. Unequal group sizes do not change the definitions of \(H\) or \(E\); they do rule out shortcuts that rely on equal-size simplifications.
For a planned scalar contrast among groups, choose coefficients \(a_1,\ldots,a_G\) with \(\sum_g a_g=0\). Its estimated contrast-response vector is \(\hat\delta=\sum_g a_g\bar z_g\). Under the common-covariance assumption, independence gives $$ \operatorname{Var}(\hat\delta) =\left(\sum_{g=1}^G\frac{a_g^2}{n_g}\right)\Sigma_C. $$ This formula shows directly how group size enters precision. It also supplies the estimated covariance by replacing \(\Sigma_C\) with \(S_p\). If several such comparisons are tested, multiplicity control remains necessary.
Worked Example: Pooling Covariance Estimates With Unequal Sizes
Two groups have \(n_1=6\) and \(n_2=9\) subjects, so their covariance matrices each use two contrast coordinates. Suppose $$ S_1=\begin{pmatrix}0.8&0\\0&6\end{pmatrix}, \qquad S_2=\begin{pmatrix}1.125&0\\0&7.625\end{pmatrix}. $$ Calculate the pooled covariance.
Here \(N-G=6+9-2=13\). The first diagonal element of the pooled matrix is $$ \frac{(6-1)(0.8)+(9-1)(1.125)}{13} =\frac{5(0.8)+8(1.125)}{13} =\frac{4+9}{13}=1. $$ The second diagonal element is $$ \frac{5(6)+8(7.625)}{13} =\frac{30+61}{13}=7. $$ Both off-diagonal elements are zero, so $$ S_p=\begin{pmatrix}1&0\\0&7\end{pmatrix}. $$ The weights are 5 and 8, the groups’ residual degrees of freedom—not 6 and 9, the group sizes themselves.
Two-Group Hotelling Comparison
For two groups, let \(d=\bar z_1-\bar z_2\), let \(q\) be the number of contrast responses, and let \(N=n_1+n_2\). Under the null hypothesis of equal contrast-response means, the pooled two-sample Hotelling statistic is $$ T^2=\frac{n_1n_2}{N}d^\mathsf{T}S_p^{-1}d. $$ If the contrast-response vectors are independently sampled from multivariate normal distributions with the same positive-definite covariance, and \(N-q-1>0\), then $$ F=\frac{N-q-1}{q(N-2)}T^2 $$ has an \(F\) distribution with \(q\) and \(N-q-1\) degrees of freedom under the null. The pooled matrix must be invertible; in particular, its residual degrees of freedom must be adequate for the contrast dimension.
Worked Example: Exact Two-Group Test With Unequal Sizes
Suppose \(n_1=6\), \(n_2=9\), the contrast-response mean difference is \(d=(1,1)^\mathsf{T}\), and the pooled covariance is \(S_p=\begin{pmatrix}1&0\\0&7\end{pmatrix}\), as in the preceding calculation. Test equality of the two group mean vectors using the exact Hotelling conversion.
First, \(N=15\), \(q=2\), and $$ d^\mathsf{T}S_p^{-1}d =\begin{pmatrix}1&1\end{pmatrix} \begin{pmatrix}1&0\\0&1/7\end{pmatrix} \begin{pmatrix}1\\1\end{pmatrix} =1+\frac17=\frac87. $$ The sample-size multiplier is \(n_1n_2/N=6(9)/15=18/5\). Therefore $$ T^2=\frac{18}{5}\frac87=\frac{144}{35}. $$ The corresponding \(F\) statistic is $$ F=\frac{15-2-1}{2(15-2)}\frac{144}{35} =\frac{12}{26}\frac{144}{35} =\frac{864}{455} \approx1.899, \qquad df=(2,12). $$ The displayed degrees of freedom and conversion apply because the contrast responses satisfy the stated normality and common-covariance assumptions. A substantive conclusion would compare this statistic with the chosen reference threshold or use its \(F_{2,12}\) tail probability.
Which Balance Assumptions Remain?
There are two distinct notions that are easy to conflate. Between-group balance means that the groups have equal sample sizes. It is not required for the weighted estimates and tests above. Within-subject completeness means that each included subject has measurements on the same occasions needed to form the chosen contrast vector. That requirement is built into this analysis: incomplete profiles cannot simply be multiplied by the same full contrast matrix.
The multivariate contrast analysis uses the full covariance matrix of the contrast responses. It does not require sphericity, which is a covariance restriction used for particular univariate repeated-measures procedures. However, it does require a common contrast covariance across groups for the pooled-covariance test to have its stated exact calibration. If covariances differ, especially when the smaller group is also the more variable group, pooling may give misleading standard errors and test calibration.
A frequent mistake is to average group means equally and then use the pooled covariance as if group size were irrelevant. The correction is to use \(n_g/N\) for the grand mean, \(n_g-1\) for pooling covariance matrices, and the actual \(n_g\) values in each planned contrast’s variance. Another mistake is to assume that unequal sizes themselves violate sphericity or invalidate multivariate analysis. They do neither; they change the weights, while covariance assumptions must be assessed separately.
Check Your Understanding
Try these questions before reviewing the derivations.
- Why does the pooled covariance use weights \(n_g-1\), rather than \(n_g\)?
- For two groups of sizes 5 and 11, what weights define the weighted grand mean?
- If the contrast covariance differs across groups, what does the pooled covariance estimate in expectation?
- State the assumptions needed for the exact two-group Hotelling \(F\) conversion.
- Why does complete repeated-measures data not imply equal group sizes?