Tutorials › Multivariate Statistics (Graduate) › Common Errors in Repeated-Measures Contrast Analysis

Contrasts and Repeated Measures · Tutorial 380 of 975

Common Errors in Repeated-Measures Contrast Analysis

Check that a repeated-measures hypothesis is genuinely a contrast, has the intended rank and covariance assumptions, and uses the correct degrees of freedom.

Advanced 12 min read

What You'll Learn

  • Identify when a matrix row fails to remove the profile’s overall level.
  • Determine the effective number of hypotheses from a contrast matrix’s rank.
  • Distinguish sphericity on contrast coordinates from compound symmetry.
  • Recognize why singular compound symmetry need not meet the positive-variance definition of sphericity.
  • Apply univariate epsilon corrections to the within-subject degrees of freedom they adjust.

Why Contrast Errors Change the Question

Repeated-measures analyses compare a profile of measurements taken on the same subject. A contrast is designed to isolate a feature of that profile—such as a difference between occasions or a planned trend—without inadvertently testing its overall level. Small mistakes in the contrast matrix or its covariance assumptions can change the hypothesis, make a test undefined, or produce inappropriate reference degrees of freedom.

Let \(p\) be the number of occasions and let \(\mu\in\mathbb{R}^p\) be the mean profile. A row \(c'\) is a within-subject contrast when its coefficients sum to zero. For a matrix \(C\) with \(k\) rows, the intended contrast property is \(C\mathbf{1}_p=0\), where \(\mathbf{1}_p\) is the \(p\)-vector of ones. A contrast set can still have a problem even when every row meets this condition: its rows may be redundant.

Definition: A row \(c'\in\mathbb{R}^{1\times p}\) is a contrast if \(c'\mathbf{1}_p=0\). A matrix \(C\in\mathbb{R}^{k\times p}\) is a contrast matrix if \(C\mathbf{1}_p=0\). Its effective number of independent contrast directions is \(\operatorname{rank}(C)\), not necessarily its number of rows.

Worked Example: A Row That Does Not Remove the Overall Level

Worked Example: A Row That Does Not Remove the Overall Level

Suppose a three-occasion mean profile is \(\mu=(5,7,9)'\), and an analyst proposes \(C=\begin{pmatrix}1&-1&0\\1&1&1\end{pmatrix}\). Check the rows and interpret the resulting quantities.

The first row sums to \(1-1+0=0\), so it is a contrast. Its value is \(5-7=-2\), the difference between the first and second occasion means.

The second row sums to \(1+1+1=3\), not zero. Its value is \(5+7+9=21\), which changes with the overall profile level. It is not a within-subject contrast.

Consequently, the joint null \(C\mu=0\) asks both for equality of the first two means and for their three means to sum to zero. It is not simply a test of the intended within-subject features. Replacing the second row with a zero-sum row, or removing it if it was not intended, changes the hypothesis to the one actually sought.

A useful check is to add a constant \(a\) to every component of a profile. A genuine contrast is unchanged, because \(c'(\mu+a\mathbf{1}_p)=c'\mu+a(c'\mathbf{1}_p)=c'\mu\). A row whose coefficients do not sum to zero changes under this shift and therefore retains information about overall level.

Redundant Rows and Effective Rank

The number of written rows is not always the number of distinct restrictions. If \(C\) has rank \(q<k\), some rows are linear combinations of others. The null hypothesis \(C\mu=0\) still has only \(q\) independent restrictions. Treating the \(k\) rows as \(k\) independent effects can lead to incorrect degrees of freedom, a singular covariance matrix for the transformed outcomes, or an attempted inverse that does not exist.

Worked Example: Three Rows but Only Two Independent Contrasts

Consider three occasion means and the rows \(c_1'=(1,-1,0)\), \(c_2'=(0,1,-1)\), and \(c_3'=(1,0,-1)\). Each row sums to zero, but \(c_3'=c_1'+c_2'\).

Thus the matrix has three rows but rank two. For any \(\mu=(\mu_1,\mu_2,\mu_3)'\), the third transformed mean is \(\mu_1-\mu_3=(\mu_1-\mu_2)+(\mu_2-\mu_3)\).

The joint null is equivalent to the first two differences both being zero; then the third is necessarily zero. There are two independent restrictions, not three. An analysis should use an independent basis for the same row space or otherwise account for the rank, rather than treating the redundant third row as additional information.

Result: If two matrices \(C\) and \(A\) have the same row space, then \(C\mu=0\) and \(A\mu=0\) describe the same null hypothesis.

To see this, each row of \(C\) is a linear combination of rows of \(A\), so there is a matrix \(B\) with \(C=BA\). Hence \(A\mu=0\) implies \(C\mu=0\). Reversing the roles gives a matrix \(D\) with \(A=DC\), so \(C\mu=0\) implies \(A\mu=0\). The row space therefore captures the distinct restrictions; duplicated rows do not create new ones. \(\square\)

In computation, a rank-revealing decomposition or a direct rank check can identify dependencies. Before interpreting a multivariate test based on transformed outcomes, check that the selected contrast coordinates are linearly independent. If they are not, remove redundant coordinates or use an independent basis spanning the intended contrast space.

Sphericity Is Not the Same as Compound Symmetry

Let \(\Sigma\) be the within-subject covariance matrix across the \(p\) occasions, and let \(r=p-1\). Let \(Q\) be a \(p\times r\) matrix whose columns are an orthonormal basis for the contrast subspace: \(Q'Q=I_r\) and \(Q'\mathbf{1}_p=0\). Sphericity says that all orthonormal contrast coordinates have equal, positive variance. Compound symmetry is a stronger structural condition on the full covariance matrix.

Definition: Sphericity on the contrast subspace holds when \(Q'\Sigma Q=\lambda I_r\) for some \(\lambda>0\). Compound symmetry has the form \(\Sigma=aI_p+b\mathbf{1}_p\mathbf{1}_p'\), where the parameters must make \(\Sigma\) a valid covariance matrix. In this representation, \(a\) is the variance in every contrast direction.
Result: A compound-symmetry covariance matrix implies sphericity as defined above if \(a>0\). The implication need not hold in the reverse direction.

For the forward implication, use \(Q'\mathbf{1}_p=0\) and \(Q'Q=I_r\):

$$ Q'\Sigma Q =Q'(aI_p+b\mathbf{1}_p\mathbf{1}_p')Q =aI_r+b(Q'\mathbf{1}_p)(\mathbf{1}_p'Q) =aI_r. $$

When \(a>0\), this is the required positive scalar multiple of the identity. But if \(a=0\), then \(Q'\Sigma Q=0\), which does not meet the definition requiring \(\lambda>0\). In particular, \(\Sigma=\mathbf{1}_p\mathbf{1}_p'\) is a valid, singular compound-symmetry covariance matrix with \(a=0,b=1\). It has zero variance in every contrast direction and does not satisfy this positive-variance definition of sphericity. Thus the implication must not be stated without the positive-contrast-variance condition. \(\square\)

Worked Example: Sphericity Without Compound Symmetry

For \(p=3\), take \(v=(1/4,-1/4,0)'\) and define \(\Sigma=I_3+\mathbf{1}_3v'+v\mathbf{1}_3'\). Its entries are

$$ \Sigma= \begin{pmatrix} 3/2&0&1/4\\ 0&1/2&-1/4\\ 1/4&-1/4&1 \end{pmatrix}. $$

This is a valid positive-definite covariance matrix. In the orthonormal directions \(\mathbf{1}_3/\sqrt{3}\), \(v/\lVert v\rVert\), and a contrast direction orthogonal to \(v\), its matrix has a \(2\times2\) block with diagonal entries 1 and off-diagonal entries \(\sqrt{3/8}\), plus a remaining eigenvalue of 1. The block has eigenvalues \(1+\sqrt{3/8}\) and \(1-\sqrt{3/8}\), both positive because \(\sqrt{3/8}<1\).

For any orthonormal contrast basis \(Q\), the terms involving \(\mathbf{1}_3\) vanish: \(Q'\Sigma Q=Q'I_3Q=I_2\). Thus sphericity holds with \(\lambda=1\). Yet the diagonal entries of \(\Sigma\) are unequal, so it cannot have compound symmetry, which requires equal variances. This verifies that sphericity does not imply compound symmetry.

The key distinction is that sphericity constrains covariance only after projection onto contrast coordinates. It does not require the full covariance matrix to have equal variances or equal pairwise covariances. Assuming the two conditions are interchangeable can lead to incorrect descriptions of the covariance structure.

Correcting the Degrees of Freedom That Belong to the Effect

In a univariate repeated-measures \(F\) test, the uncorrected degrees of freedom for a within-subject effect of rank \(q\) are \(q\) for the numerator and \(\nu q\) for the denominator, where \(\nu\) is the between-subject residual degrees of freedom for that model. For a one-group analysis with \(n\) independent subjects, for example, \(\nu=n-1\). A Greenhouse–Geisser or Huynh–Feldt adjustment uses an epsilon for the relevant within-subject effect and scales both of these degrees of freedom. This is a degrees-of-freedom approximation, not a change to the observed \(F\) statistic.

For an effect represented by \(q\) independent contrast coordinates with covariance matrix \(V\), the Greenhouse–Geisser form is \(\epsilon_{\mathrm{GG}}=\{\operatorname{tr}(V)\}^2/[q\operatorname{tr}(V^2)]\). For positive-definite \(V\), it lies between \(1/q\) and 1. The epsilon and \(q\) must refer to the same effect. An epsilon calculated for a larger contrast space should not automatically be applied to a different, lower-rank contrast set.

Worked Example: Applying an Epsilon Adjustment to the Right Degrees of Freedom

Suppose a study has three groups, \(N=30\) subjects in total, and a four-occasion within-subject effect. Assume the effect uses all \(q=4-1=3\) independent contrast dimensions, and the model has \(\nu=N-3=27\) between-subject residual degrees of freedom. The uncorrected within-subject degrees of freedom are \((3,27\times3)=(3,81)\).

If the Greenhouse–Geisser estimate for this effect is \(\epsilon_{\mathrm{GG}}=0.72\), the adjusted degrees of freedom are \((0.72\times3,\;0.72\times81)=(2.16,58.32)\). The \(F\) statistic is evaluated against the \(F\) reference distribution with these adjusted degrees of freedom.

The correction does not change the between-group numerator degrees of freedom, which would be \(3-1=2\) for a separate between-group test. Nor should the within-subject denominator be left at 81 while only the numerator is adjusted. The correction applies to the within-subject effect’s numerator and associated repeated-measures denominator degrees of freedom.

For a one-dimensional contrast, \(q=1\), there is only one contrast variance to compare with itself, so the Greenhouse–Geisser epsilon is 1. A sphericity correction is not a remedy for a noncontrast row or for rank deficiency: those problems change the hypothesis or its dimension and must be addressed first.

Common Mistakes and a Reliable Check

  • Calling every row a contrast. Check each row sum. A row with a nonzero sum retains overall-level information.
  • Counting rows instead of independent restrictions. Compute the matrix rank; redundant rows do not increase the number of tested dimensions.
  • Equating sphericity with compound symmetry. Compound symmetry with \(a>0\) implies sphericity, but a sphericity covariance can have unequal occasion variances. The singular case \(a=0\) has no positive contrast variance and fails the stated sphericity definition.
  • Adjusting the wrong degrees of freedom. Apply the effect’s epsilon to both its within-subject numerator and repeated-measures denominator degrees of freedom, not to a separate between-subject test.

A careful analysis therefore starts by checking that every intended within-subject row sums to zero, then checks the rank and interpretation of the row space. Only after the effect and its dimension are clear should the covariance assumption and any univariate degrees-of-freedom correction be considered.

Check Your Understanding

Use these questions to check whether you can distinguish the four common sources of error.

  1. Why does a row \(c'\) with \(c'\mathbf{1}_p\ne0\) fail to remove overall profile level?
  2. A contrast matrix has five rows but rank three. How many independent restrictions does its null hypothesis impose?
  3. For compound symmetry \(\Sigma=aI_p+b\mathbf{1}_p\mathbf{1}_p'\), what additional condition ensures sphericity under the definition requiring positive contrast variance?
  4. Can a covariance matrix satisfy sphericity without compound symmetry? What feature of the full covariance matrix can differ?
  5. If an effect has uncorrected degrees of freedom \((q,\nu q)\), which degrees of freedom are scaled by a univariate epsilon adjustment?
Clinical Biostats