Tutorials › Multivariate Statistics (Graduate) › Exact Hotelling Tests for Planned Group Contrasts

Two-Sample and Multiple Means · Tutorial 275 of 975

Exact Hotelling Tests for Planned Group Contrasts

Learn how to test and form a confidence region for one planned multivariate contrast using the pooled within-group covariance.

Intermediate 12 min read

What You'll Learn

  • Define a planned contrast of several multivariate group means
  • Calculate the contrast’s estimated covariance using group sizes and pooled within-group covariance
  • Derive the exact Hotelling \(T^2\) statistic and its F distribution under the null
  • Identify the residual degrees of freedom and conditions for the covariance estimate to be invertible
  • Construct a confidence region for a single planned contrast
  • Recognize common errors in contrast scaling and covariance estimation

Why a Planned Contrast Has an Exact Test

A planned multivariate contrast asks about one specified linear combination of group mean vectors. For example, a study may compare one treatment group with the average of several control groups, where each patient contributes a vector of outcomes. The question is not whether all group means are equal; it is whether the particular vector-valued contrast is zero.

Under independent multivariate normal sampling with a common covariance matrix, the contrast estimate has a covariance that can be estimated from the pooled within-group covariance. Its standardized squared length has an exact Hotelling \(T^2\) calibration. The result depends on accounting for the contrast coefficients and group sample sizes together.

Definition: Suppose there are \(g\) independent groups. In group \(i\), \(X_{ij}\) is a \(p\)-dimensional observation, \(j=1,\ldots,n_i\), with mean vector \(\mu_i\) and common covariance matrix \(\Sigma\). A single planned group contrast is $$ \psi=\sum_{i=1}^g c_i\mu_i, \qquad \sum_{i=1}^g c_i=0, $$ where the coefficients \(c_i\) are fixed in advance and are not all zero. Its estimator is \(\hat\psi=\sum_{i=1}^g c_i\bar X_i\), where \(\bar X_i=n_i^{-1}\sum_{j=1}^{n_i}X_{ij}\). The zero-sum condition makes this a contrast of group means.

Write \(N=\sum_{i=1}^g n_i\) and \(\nu=N-g\), the total within-group residual degrees of freedom. The pooled within-group covariance estimate is

$$ S_p=\frac{1}{\nu}\sum_{i=1}^g\sum_{j=1}^{n_i} (X_{ij}-\bar X_i)(X_{ij}-\bar X_i)'. $$

The subscript \(p\) here labels the pooled estimate; the vectors and covariance matrices are \(p\)-dimensional. If \(\nu\ge p\), this estimate is positive definite with probability one under the model, so its inverse exists.

The Contrast Covariance and Test Statistic

Independence across groups gives \(\operatorname{Cov}(\bar X_i)=\Sigma/n_i\), and the group sample means are independent. Therefore,

$$ \operatorname{Cov}(\hat\psi) =\sum_{i=1}^g c_i^2\operatorname{Cov}(\bar X_i) =q\Sigma, \qquad q=\sum_{i=1}^g\frac{c_i^2}{n_i}. $$

The scalar \(q\) is determined by both the contrast coefficients and the group sample sizes. Replacing \(\Sigma\) by \(S_p\) estimates the covariance of the contrast by \(qS_p\).

Theorem: Assume the observations are independent and \(X_{ij}\sim N_p(\mu_i,\Sigma)\), with the same positive-definite \(\Sigma\) in every group. For a fixed, nonzero contrast \(c_1,\ldots,c_g\) summing to zero, suppose \(\nu=N-g\ge p\). Under \(H_0:\psi=0\), define $$ T^2=\hat\psi'(qS_p)^{-1}\hat\psi. $$ Then $$ \frac{\nu-p+1}{\nu p}T^2\sim F_{p,\,\nu-p+1}. $$

Worked Example: Comparing One Group With the Average of Two Others

Three groups have sample sizes \(10,12,8\), and the planned contrast is \(\psi=(\mu_1+\mu_2)/2-\mu_3\). Thus \(c=(1/2,1/2,-1)\), which sums to zero. Suppose the observed sample means are \((10,5)'\), \((12,7)'\), and \((8,4)'\), and the pooled covariance estimate is $$ S_p=\begin{pmatrix}4&1\\1&3\end{pmatrix}. $$

The estimated contrast is $$ \hat\psi=\tfrac12(10,5)'+\tfrac12(12,7)'-(8,4)'=(3,2)'. $$ The coefficient-and-size factor is $$ q=\frac{(1/2)^2}{10}+\frac{(1/2)^2}{12}+\frac{(-1)^2}{8} =\frac1{40}+\frac1{48}+\frac18=\frac{41}{240}. $$ The determinant of \(S_p\) is \(4(3)-1(1)=11>0\), and $$ S_p^{-1}=\frac1{11}\begin{pmatrix}3&-1\\-1&4\end{pmatrix}. $$ Consequently, $$ \hat\psi'S_p^{-1}\hat\psi =\frac1{11}(3,2)\begin{pmatrix}3&-1\\-1&4\end{pmatrix}\begin{pmatrix}3\\2\end{pmatrix} =\frac1{11}(3,2)\begin{pmatrix}7\\5\end{pmatrix} =\frac{31}{11}. $$ Since \((qS_p)^{-1}=q^{-1}S_p^{-1}\), $$ T^2=\frac{240}{41}\frac{31}{11}=\frac{7440}{451}\approx16.50. $$ Here \(N=30\), \(g=3\), and \(\nu=27\). The null calibration is $$ \frac{27-2+1}{27(2)}T^2=\frac{13}{27}T^2\sim F_{2,26}. $$ The observed transformed statistic is approximately \(7.94\). A test at level \(\alpha\) rejects when this value exceeds the \(1-\alpha\) quantile of \(F_{2,26}\).

Why the F Calibration Is Exact

The proof uses two facts supplied by multivariate normal sampling: the contrast estimate is normal, and it is independent of the pooled within-group covariance estimate. The distinction between centering by a population mean and centering by a sample mean matters in establishing this independence.

1
Transform each group’s observations.
For group \(i\), apply an orthogonal transformation to the \(n_i\) observations, with first row \(n_i^{-1/2}(1,\ldots,1)\). Apply it to the observations centered by the population mean \(\mu_i\). The first transformed vector is \(\sqrt{n_i}(\bar X_i-\mu_i)\); the other \(n_i-1\) transformed vectors are residual coordinates.
2
Use normality and orthogonality.
The transformed vectors are jointly normal. Their cross-covariances are zero because the transformation is orthogonal, so they are independent \(N_p(0,\Sigma)\) vectors. In particular, the first coordinate is not zero: the observations were centered by \(\mu_i\), not by \(\bar X_i\).
3
Identify the within-group scatter.
Orthogonality preserves sums of outer products. Removing the first transformed coordinate leaves exactly \(\sum_j(X_{ij}-\bar X_i)(X_{ij}-\bar X_i)'\). Across groups, the remaining \(\sum_i(n_i-1)=\nu\) independent normal residual coordinates imply \(\nu S_p\sim W_p(\Sigma,\nu)\). They are independent of all group sample means, and hence of \(\hat\psi\).
4
Standardize the contrast.
Under \(H_0\), \(Z=(q\Sigma)^{-1/2}\hat\psi\sim N_p(0,I_p)\). It is independent of \(W=\Sigma^{-1/2}(\nu S_p)\Sigma^{-1/2}\sim W_p(I_p,\nu)\), and \(T^2=\nu Z'W^{-1}Z\).

For completeness, the normal-Wishart quadratic-form result used in the last step can be seen directly. If \(Z\sim N_p(0,I_p)\) and \(W\sim W_p(I_p,\nu)\) are independent, then $$ Z'W^{-1}Z\ \stackrel{d}{=}\ \frac{U}{V}, \qquad U\sim\chi^2_p,\quad V\sim\chi^2_{\nu-p+1}, $$ with \(U\) and \(V\) independent. To verify this, condition on \(Z\) and rotate its direction to the first coordinate; the identity covariance of \(Z\) and the identity-scale Wishart distribution are invariant under this rotation. The squared length \(Z'Z\) has a \(\chi^2_p\) distribution. Represent \(W=A'A\), with \(A\) a \(\nu\times p\) matrix of independent standard normal entries, and partition its columns as \(A=(a_1,A_2)\). The reciprocal of the first diagonal entry of \(W^{-1}\) is the Schur complement $$ a_1'\{I-A_2(A_2'A_2)^{-1}A_2'\}a_1. $$ Conditional on \(A_2\), the matrix in braces is an orthogonal projection of rank \(\nu-p+1\). Since \(a_1\) is an independent standard normal vector, this quadratic form has a \(\chi^2_{\nu-p+1}\) distribution. This denominator is independent of the length of \(Z\), giving the stated ratio. For \(p=1\), the same conclusion follows directly with denominator degrees of freedom \(\nu\).

By the definition of the \(F\) distribution, \((U/p)/(V/(\nu-p+1))\sim F_{p,\nu-p+1}\). Since \(T^2=\nu U/V\), multiplying by \((\nu-p+1)/(\nu p)\) gives the theorem. \(\square\)

Worked Example: A Treatment Versus the Average of Three Controls

Suppose four groups have sizes \(12,9,15,12\), with group 1 the treatment group. The planned contrast compares it with the unweighted average of groups 2–4: $$ c=(1,-1/3,-1/3,-1/3). $$ Suppose the estimated group means are \((5,2)'\), \((2,1)'\), \((4,0)'\), and \((3,2)'\), respectively, and $$ S_p=\begin{pmatrix}2&0\\0&1\end{pmatrix}. $$ The coefficients sum to zero. The average of the three comparison-group means is \((3,1)'\), so \(\hat\psi=(2,1)'\). The contrast variance factor is $$ q=\frac1{12}+\frac{1/9}{9}+\frac{1/9}{15}+\frac{1/9}{12} =\frac1{12}+\frac1{81}+\frac1{135}+\frac1{108} =\frac{91}{810}. $$ Because \(S_p^{-1}=\operatorname{diag}(1/2,1)\), the squared length before dividing by \(q\) is $$ \hat\psi'S_p^{-1}\hat\psi=(2,1)\begin{pmatrix}1/2&0\\0&1\end{pmatrix}\begin{pmatrix}2\\1\end{pmatrix}=3. $$ Thus \(T^2=3/(91/810)=2430/91\approx26.70\). Here \(N=48\), \(g=4\), and \(\nu=44\), so the null-calibrated value is $$ \frac{44-2+1}{44(2)}T^2=\frac{43}{88}\frac{2430}{91}\approx13.05, $$ which is compared with \(F_{2,43}\). The treatment-versus-average question is one contrast; this calculation alone does not provide simultaneous inference for a collection of contrasts.

Confidence Region and Scaling

The same exact calibration gives a confidence region for the unknown contrast vector. Let \(F_{p,\nu-p+1;1-\alpha}\) denote the \(1-\alpha\) quantile of the indicated \(F\) distribution. Under the model conditions in the theorem, a \(1-\alpha\) confidence region for \(\psi\) is

$$ \left\{\psi: (\hat\psi-\psi)'(qS_p)^{-1}(\hat\psi-\psi) \le \frac{p\nu}{\nu-p+1}F_{p,\nu-p+1;1-\alpha} \right\}. $$

Indeed, for each fixed true \(\psi\), the centered estimator \(\hat\psi-\psi\) has covariance \(q\Sigma\), is independent of \(S_p\), and the theorem’s derivation applies to its quadratic form. The region therefore has coverage \(1-\alpha\) exactly under the stated Gaussian common-covariance model.

Worked Example: Rescaling Does Not Change the Test

For two groups of sizes \(8\) and \(12\), take the contrast coefficients \((1,-1)\). Suppose \(\hat\psi=(1,2)'\) and \(S_p=\operatorname{diag}(2,1)\). Then \(q=1/8+1/12=5/24\), and $$ \hat\psi'S_p^{-1}\hat\psi=\frac12+4=\frac92, \qquad T^2=\frac{24}{5}\frac92=\frac{108}{5}=21.6. $$ Now multiply both contrast coefficients by \(2\). The estimated contrast becomes \(2\hat\psi\), and the variance factor becomes \(4q\). Therefore the new statistic is $$ (2\hat\psi)'(4qS_p)^{-1}(2\hat\psi) =4\hat\psi'\{4qS_p\}^{-1}\hat\psi =\hat\psi'(qS_p)^{-1}\hat\psi =21.6. $$ The contrast’s units change, but the test statistic does not. Here \(\nu=8+12-2=18\), and the exact null calibration is \((17/36)T^2\sim F_{2,17}\).

Common Mistakes and Practical Interpretation

  • Using the wrong factor for the estimated covariance. The covariance estimate is \(qS_p\), where \(q=\sum_i c_i^2/n_i\). Omitting the sample sizes or using \(\sum_i c_i/n_i\) does not estimate the contrast covariance.
  • Using between-group scatter as the covariance estimate. The exact result uses pooled within-group residual scatter. Between-group variation reflects differences among the means being studied and is not a substitute for \(S_p\).
  • Using the wrong degrees of freedom. The covariance estimate has \(\nu=N-g\) residual degrees of freedom, and the transformed statistic has denominator degrees of freedom \(\nu-p+1\). The numerator degrees of freedom are the outcome dimension \(p\).
  • Centering the transformed observations by their sample means too early. After that centering, the transformed mean coordinate is zero. To establish independence, first transform observations centered by the population mean; the mean coordinate is then \(\sqrt{n_i}(\bar X_i-\mu_i)\), independent of the residual coordinates.
  • Assuming exactness under unequal covariance matrices or nonnormal sampling. The stated F calibration relies on independent multivariate normal observations and one common positive-definite covariance matrix. It is not automatically exact when these assumptions fail.

The practical value of this result is that a single planned multivariate question can be answered without estimating each group covariance separately: the pooled residual covariance supplies the scale, and the contrast-specific factor \(q\) accounts for the design. If \(\nu<p\), the pooled covariance cannot be inverted in the ordinary full-dimensional statistic; this exact test therefore requires enough residual degrees of freedom.

Key takeaway: For one fixed contrast, estimate its covariance by \(qS_p\), with \(q=\sum_i c_i^2/n_i\). Under independent normal groups with common covariance, the resulting Hotelling statistic has an exact \(F_{p,\nu-p+1}\) calibration after multiplication by \((\nu-p+1)/(\nu p)\).

Check Your Understanding

Use the definitions and conditions in this tutorial to answer the following.

  1. For coefficients \((1/2,1/2,-1)\), what group means does the contrast compare, and why do the coefficients qualify as a contrast?
  2. Explain why the covariance estimate for \(\hat\psi\) is \(qS_p\), and write \(q\) for a general contrast.
  3. With \(N=36\), \(g=4\), and outcome dimension \(p=3\), give \(\nu\) and the null F degrees of freedom, assuming the model conditions hold.
  4. Why must the observations be centered by population means, rather than sample means, in the orthogonal-transform argument for independence?
  5. What changes in the estimated contrast and in \(q\) if every contrast coefficient is multiplied by the same nonzero constant? What happens to \(T^2\)?
Clinical Biostats