Tutorials › Multivariate Statistics (Graduate) › Multivariate Tests for Repeated-Measures Effects

Contrasts and Repeated Measures · Tutorial 377 of 975

Multivariate Tests for Repeated-Measures Effects

Formulate repeated-measures hypotheses in contrast coordinates, understand multivariate test statistics and covariance requirements, and assess the cost of using multiple response dimensions.

Advanced 12 min read

What You'll Learn

  • Express a repeated-measures effect as a hypothesis about a vector of contrast-response means.
  • Distinguish the covariance assumptions of multivariate and univariate repeated-measures tests.
  • Define the hypothesis and error matrices used in multivariate linear-model tests.
  • Interpret Wilks’ lambda, Pillai’s trace, Hotelling–Lawley trace, and Roy’s largest root.
  • Explain how the number of contrast dimensions affects estimability and power.
  • Compare multivariate tests with Greenhouse–Geisser and Huynh–Feldt corrected univariate tests.

From Repeated Measurements to a Multivariate Response

A repeated-measures effect can be described by asking whether particular combinations of the measurements have nonzero means. If a study records \(k\) occasions for each subject, a contrast matrix turns the \(k\) measurements into a vector of contrast scores. Testing the effect then becomes a test about the mean vector of those scores, or about differences between such mean vectors across groups.

This formulation matters because it separates two questions: which mean pattern is being tested? and how is uncertainty in the contrast scores modelled? A multivariate test uses the full covariance matrix of the contrast responses. Unlike the ordinary univariate repeated-measures \(F\) test, it does not require sphericity. That flexibility has a cost: it must estimate and invert a covariance matrix whose dimension is the number of contrasts being tested.

Definition: Let \(Y_i=(Y_{i1},\ldots,Y_{ik})^T\) be the vector of measurements for subject \(i\), and let \(C\) be a \(k\times q\) matrix of rank \(q\) whose columns specify the contrasts of interest. The subject’s contrast-response vector is \(Z_i=C^T Y_i\), a \(q\)-dimensional vector. A repeated-measures effect is formulated as a hypothesis about the mean of \(Z_i\), or about differences in that mean across groups.

The columns of \(C\) must encode the intended effect. For example, columns may span occasion contrasts for a time effect, or a selected subset such as linear and quadratic contrasts. If all \(k-1\) independent occasion contrasts are included, then \(q=k-1\). A different full-rank basis for the same contrast subspace gives different coordinates but represents the same effect.

The Multivariate Linear Model for Contrast Responses

For \(n\) subjects, collect the row vectors \(Z_i^T\) in an \(n\times q\) response matrix \(Z\). A general linear model is

$$ Z=XB+U, $$

where \(X\) is an \(n\times p\) design matrix of rank \(p\), \(B\) is a \(p\times q\) matrix of response means or regression coefficients, and the rows of \(U\) are independent \(N_q(0,\Sigma)\) vectors. The covariance matrix \(\Sigma\) is assumed positive definite. A linear hypothesis about the design coefficients has the form \(LB=0\), where \(L\) is a specified matrix of hypothesis contrasts.

In a between-group study, for instance, a group effect asks whether group mean vectors of the within-subject contrast responses are equal. A group-by-occasion effect is also expressed as a group comparison of contrast-response means, using contrasts that represent the intended occasion pattern. The exact rows of \(L\) depend on the design and the hypothesis.

Let \(\hat B=(X^TX)^{-1}X^TZ\) be the least-squares estimate, and let \(R=Z-X\hat B\) be the residual matrix. For a full-row-rank \(L\), the hypothesis and error sums-of-products matrices are

$$ H=(L\hat B)^T\{L(X^TX)^{-1}L^T\}^{-1}(L\hat B), \qquad E=R^TR. $$

Here \(H\) measures variation associated with the tested hypothesis, while \(E\) measures residual variation. Standard multivariate tests compare these matrices. Their common null hypothesis is \(LB=0\), but they summarize the evidence in different ways.

Definition: When \(E\) is positive definite, four standard multivariate criteria are Wilks’ lambda, \(\Lambda=|E|/|E+H|\); Pillai’s trace, \(V=\operatorname{tr}\{H(H+E)^{-1}\}\); the Hotelling–Lawley trace, \(\operatorname{tr}(E^{-1}H)\); and Roy’s largest root, the largest eigenvalue of \(E^{-1}H\). Their test calibrations depend on the hypothesis and error degrees of freedom. Under multivariate normal errors, standard finite-sample \(F\) transformations or bounds are available; some transformations are exact in particular cases, while others are approximations.

These criteria answer the same null-hypothesis question, but emphasize different summaries of the roots of the hypothesis relative to error. Wilks’ lambda is a ratio of determinants; smaller values indicate greater separation attributable to the hypothesis. Pillai’s trace sums bounded root contributions. The Hotelling–Lawley trace sums the roots, and Roy’s largest root focuses on the largest one. Choosing among them is not the same as choosing which contrast hypothesis to test.

One-Sample Contrast Test and Its Exact Calibration

For a single group, the central hypothesis is often \(E[Z_i]=0\). Let \(\bar Z=n^{-1}\sum_i Z_i\), and let \(S=(n-1)^{-1}\sum_i(Z_i-\bar Z)(Z_i-\bar Z)^T\). If the \(Z_i\) are independent \(N_q(\mu,\Sigma)\), with \(\Sigma\) positive definite, Hotelling’s one-sample \(T^2\) statistic is

$$ T^2=n\bar Z^T S^{-1}\bar Z. $$

Under \(H_0:\mu=0\), and when \(n>q\), its exact reference distribution is

$$ \frac{n-q}{q(n-1)}T^2 \sim F_{q,n-q}. $$

The normality and common covariance assumptions apply to the contrast-response vectors, not to each occasion in isolation. The unrestricted positive-definite \(\Sigma\) allows unequal contrast variances and nonzero correlations among contrast scores.

Worked Example: Testing Two Occasion Contrasts

Six subjects are measured at three occasions. Use the adjacent differences \(Z_i=(Y_{i2}-Y_{i1},\,Y_{i3}-Y_{i2})^T\), and suppose their observed contrast vectors are \((2,0.5),(0,0.5),(1,1.5),(1,-0.5),(2,1.5),(0,-0.5)\). Test whether both population contrast means are zero.

The sample mean is \(\bar Z=(1,0.5)^T\). The six deviations from this mean are \((1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1)\). Their outer products sum to \(\begin{pmatrix}4&2\\2&4\end{pmatrix}\), so

$$ S=\frac{1}{5}\begin{pmatrix}4&2\\2&4\end{pmatrix} =\begin{pmatrix}0.8&0.4\\0.4&0.8\end{pmatrix}, \qquad S^{-1}=\begin{pmatrix}5/3&-5/6\\-5/6&5/3\end{pmatrix}. $$

Thus \(\bar Z^TS^{-1}\bar Z=5/3-5/6+5/12=5/4\), and \(T^2=6(5/4)=7.5\). The exact \(F\) statistic is

$$ F=\frac{6-2}{2(6-1)}(7.5)=3.0, \qquad F\sim F_{2,4}\ \text{under }H_0. $$

The test is joint: it assesses whether the two-dimensional mean contrast vector is zero. It does not separately test each difference at an unadjusted level.

Why the Contrast Basis Does Not Change the Test

A contrast effect is a subspace, not a particular choice of coordinates within that subspace. The following invariance explains why any invertible change of basis leaves the one-sample multivariate test unchanged.

Result: If \(W_i=A^T Z_i\) for a nonsingular \(q\times q\) matrix \(A\), then the one-sample Hotelling statistic computed from the \(W_i\) equals the statistic computed from the \(Z_i\).

Proof. Write \(\bar W=A^T\bar Z\). The sample covariance of \(W_i\) is \(S_W=A^TSA\), so \(S_W^{-1}=A^{-1}S^{-1}(A^T)^{-1}\). Therefore

$$ n\bar W^T S_W^{-1}\bar W =n\bar Z^T A\{A^{-1}S^{-1}(A^T)^{-1}\}A^T\bar Z =n\bar Z^TS^{-1}\bar Z. $$

Thus a nonsingular re-expression of the same contrast space changes neither \(T^2\) nor its \(F\) calibration. The same principle underlies multivariate linear-model tests: an invertible change of response coordinates transforms \(H\) and \(E\) together, without changing their nonzero generalized roots. \(\square\)

Worked Example: Adjacent Differences Versus Baseline Differences

In the preceding example, adjacent differences are \(Z_i=(Y_{i2}-Y_{i1},Y_{i3}-Y_{i2})^T\). An alternative basis is \(W_i=(Y_{i2}-Y_{i1},Y_{i3}-Y_{i1})^T\), so \(W_i=A^TZ_i\) for \(A=\begin{pmatrix}1&1\\0&1\end{pmatrix}\). This matrix is nonsingular, with determinant 1.

The transformed mean is \(\bar W=(1,1.5)^T\), and the transformed covariance is

$$ S_W=A^TSA =\begin{pmatrix}0.8&1.2\\1.2&2.4\end{pmatrix}, \qquad S_W^{-1}=\begin{pmatrix}5&-2.5\\-2.5&5/3\end{pmatrix}. $$

The transformed quadratic form is \(5-7.5+3.75=1.25\), the same value as before. Consequently \(T^2=6(1.25)=7.5\) in either coordinate system. This equivalence holds because both sets of contrasts span the same two-dimensional space; it would not justify replacing the tested space with a different one.

Covariance Assumptions and Dimensionality Costs

The multivariate formulation accommodates a general positive-definite covariance matrix among the \(q\) contrast responses. It does not require that these responses have equal variances or be uncorrelated. By comparison, the ordinary univariate repeated-measures \(F\) test uses a sphericity condition: in orthonormal coordinates for the tested contrast space, the contrast covariance is proportional to the identity matrix. When that condition is not justified, Greenhouse–Geisser or Huynh–Feldt corrections adjust the univariate reference degrees of freedom.

The multivariate approach is not assumption-free. It typically requires independent subjects, an appropriate mean model, multivariate normal errors for exact small-sample calibration, and enough observations to estimate the covariance matrix. In the one-sample test, \(S\) must be invertible, which requires \(n>q\). More generally, the residual degrees of freedom must be sufficient for \(E\) to be nonsingular.

The dimension cost can be stated directly. The sample covariance of \(n\) vectors is formed from centered observations whose sum is zero. Those centered vectors therefore span a space of dimension at most \(n-1\), so their covariance has rank at most \(n-1\). A \(q\times q\) sample covariance cannot be invertible if \(q\ge n\). As \(q\) grows, more covariance parameters also need to be estimated, which can reduce power when the sample size is modest.

Worked Example: When the Full Contrast Test Cannot Be Inverted

Suppose a study has \(n=4\) subjects and tests \(q=3\) contrast responses. Center the four response vectors by subtracting their sample mean. Their four centered vectors sum to zero, so at most three can be linearly independent. In fact, their span has dimension at most \(n-1=3\), which is not enough by itself to guarantee a nonsingular \(3\times3\) sample covariance.

More decisively, the exact one-sample \(F\) calibration requires \(n-q>0\). Here \(n-q=1\), so the degrees of freedom are positive, but nonsingularity still depends on the observed centered vectors spanning all three dimensions. If instead \(q=4\), then \(n-q=0\), and the covariance rank is at most 3; \(S^{-1}\) does not exist. The four-dimensional joint Hotelling test is therefore unavailable with four subjects.

A researcher might reduce the contrast space to a scientifically justified lower-dimensional set, or collect more subjects. Dropping a contrast changes the hypothesis, however, so dimension reduction should not be treated as a purely computational fix.

For example, a non-spherical contrast covariance could be \(\Sigma=\begin{pmatrix}1&0.8\\0.8&4\end{pmatrix}\). Its eigenvalues are \(4.2\) and \(0.8\), so it is positive definite but not proportional to the identity. A multivariate test can use this full covariance structure. A conventional univariate test would need an appropriate correction if its sphericity condition were not credible.

Interpretation: Joint Effect Versus Corrected Univariate Test

A multivariate test asks whether the mean vector of the chosen contrast responses satisfies the stated joint hypothesis, accounting for their estimated covariance. A corrected univariate test instead uses a scalar repeated-measures statistic and modifies its reference degrees of freedom to address departure from sphericity. Both approaches can target a repeated-measures effect, but their statistics and calibrations are not interchangeable.

The multivariate test is especially natural when the effect is specified by a manageable set of contrasts and the sample size supports estimating their covariance. Corrected univariate testing can be attractive when the effect is represented by many occasion contrasts relative to the number of subjects. A correction does not turn the univariate procedure into a multivariate analysis: it changes the reference distribution, not the response model or the meaning of the statistic.

A common mistake is to say that the multivariate test “has no covariance assumption.” It does not require sphericity, but it still assumes a well-defined covariance matrix and, for the usual exact small-sample test, multivariate normality and independent subject vectors. A second mistake is to use every possible contrast automatically. Adding dimensions may make the covariance estimate unstable or singular, and the joint test can lose power. The contrast space should be chosen to express the scientific hypothesis, while its dimension should be considered against the available sample size.

Key takeaway: A repeated-measures multivariate test is a multivariate linear-model test on contrast-response means. It accommodates nonspherical covariance, but needs adequate data to estimate that covariance. Its result concerns the joint contrast hypothesis, not a collection of separate univariate tests.

Check Your Understanding

Use these questions to check whether you can formulate and interpret the multivariate approach.

  1. For \(k\) occasions and a rank-\(q\) contrast matrix \(C\), what is the dimension of the contrast-response vector, and what does its mean represent?
  2. Which covariance condition does a multivariate repeated-measures test avoid, and which covariance requirements remain?
  3. Why does changing to another full-rank basis for the same contrast space leave Hotelling’s \(T^2\) unchanged?
  4. In the one-sample test, why is \(n>q\) necessary, and why does it not by itself guarantee that the observed covariance is invertible?
  5. How does a corrected univariate test differ in interpretation and calibration from a multivariate test of a contrast-response mean vector?
Clinical Biostats