Tutorials › Multivariate Statistics (Graduate) › Planned Polynomial Contrasts Across Ordered Occasions

Contrasts and Repeated Measures · Tutorial 368 of 975

Planned Polynomial Contrasts Across Ordered Occasions

Construct polynomial contrast coordinates for equally spaced occasions and use them to distinguish linear, quadratic, and higher-order patterns in repeated-measure means.

Advanced 10 min read

What You'll Learn

  • Center equally spaced occasion indices to define polynomial trend coordinates.
  • Construct orthogonal contrast vectors using discrete Gram–Schmidt orthogonalization.
  • Calculate and interpret linear, quadratic, cubic, and quartic contrasts.
  • Relate orthogonal contrast values to coefficients in a polynomial representation of the occasion means.
  • Distinguish algebraic orthogonality of contrast vectors from claims about sampling independence.

Why Plan Polynomial Contrasts?

A repeated-measure profile is a sequence of means, one for each occasion. When the occasions are equally spaced, a planned question might concern whether the means rise or fall linearly, bend into a curve, or show a more complex pattern. Polynomial contrasts turn these questions into specific linear combinations of the occasion means.

The word planned matters: the contrasts are chosen to represent meaningful trend components, not selected only after inspecting which comparisons look largest. For equally spaced occasions with equal weight, the natural polynomial coordinates are orthogonal. This makes it possible to describe separate components of the profile without their coefficient vectors overlapping algebraically.

Definition: Suppose there are \(k\) equally spaced occasions, indexed \(j=0,\ldots,k-1\), with population means \(\mu_0,\ldots,\mu_{k-1}\). A contrast is a linear combination \(c^\mathsf{T}\mu=\sum_{j=0}^{k-1}c_j\mu_j\) whose coefficients satisfy \(\sum_{j=0}^{k-1}c_j=0\). Two coefficient vectors are orthogonal when their ordinary inner product is zero: \(c^\mathsf{T}d=0\). A polynomial contrast of degree \(r\) uses coefficients that follow a degree-\(r\) polynomial pattern across the equally spaced occasion indices.

Constructing the Contrast Vectors

Center the occasion indices by setting \(x_j=j-(k-1)/2\). Centering puts the occasion coordinates around zero, which makes the trend patterns easier to interpret. The first polynomial vector is the constant vector \(q_0=(1,\ldots,1)^\mathsf{T}\); it represents the overall level rather than a contrast. The linear vector begins with \(x=(x_0,\ldots,x_{k-1})^\mathsf{T}\).

For higher degrees, use discrete Gram–Schmidt orthogonalization. Write \(v_r=(x_0^r,\ldots,x_{k-1}^r)^\mathsf{T}\). Starting with \(q_0\), define, for \(r=1,\ldots,k-1\),

$$ q_r=v_r-\sum_{s=0}^{r-1}\frac{q_s^\mathsf{T}v_r}{q_s^\mathsf{T}q_s}\,q_s. $$

This subtracts from \(v_r\) its components along all the earlier polynomial vectors. The resulting \(q_r\) is a degree-\(r\) polynomial pattern across the occasions and is orthogonal to each \(q_s\) for \(s<r\). Since it is orthogonal to \(q_0\), its coefficients sum to zero: it is a contrast.

Result: For distinct equally spaced occasion coordinates and \(r=0,\ldots,k-1\), the construction produces nonzero, mutually orthogonal vectors \(q_0,\ldots,q_{k-1}\). In particular, \(q_1,\ldots,q_{k-1}\) are orthogonal polynomial contrasts.

Proof. Assume \(q_0,\ldots,q_{r-1}\) are nonzero and mutually orthogonal. For any \(s<r\), the defining formula gives

$$ q_s^\mathsf{T}q_r =q_s^\mathsf{T}v_r -\sum_{u=0}^{r-1} \frac{q_u^\mathsf{T}v_r}{q_u^\mathsf{T}q_u}\,q_s^\mathsf{T}q_u =q_s^\mathsf{T}v_r-\frac{q_s^\mathsf{T}v_r}{q_s^\mathsf{T}q_s}\,q_s^\mathsf{T}q_s =0. $$

To show \(q_r\) is nonzero, suppose instead that it were zero. The formula would then say that the values of \(x^r\) at all \(k\) occasion coordinates equal the values of a polynomial of degree at most \(r-1\). Their difference is a monic degree-\(r\) polynomial with \(k\ge r+1\) distinct roots, which is impossible. Thus each step is defined and gives a nonzero vector orthogonal to all earlier ones. For \(r\ge1\), orthogonality to \(q_0\) means \(q_0^\mathsf{T}q_r=\sum_j(q_r)_j=0\), so \(q_r\) is a contrast. \(\square\)

Multiplying a contrast vector by any nonzero constant does not change the hypothesis it represents; it only changes the scale of the contrast value. Consequently, integer-scaled versions are often more convenient than the unscaled Gram–Schmidt vectors.

Worked Polynomial Contrasts

Worked Example: Three Occasions and Curvature

For three equally spaced occasions, the centered coordinates are \((-1,0,1)\). The linear vector is \(q_1=(-1,0,1)\). The centered square pattern is \((1,0,1)\), whose average is \(2/3\); subtracting that average gives \((1/3,-2/3,1/3)\). An integer-scaled quadratic contrast is therefore \(q_2=(1,-2,1)\).

Suppose the occasion means are \(10,14,18\). The linear contrast is \(q_1^\mathsf{T}\mu=-10+18=8\), indicating a higher final than initial mean. The quadratic contrast is \(q_2^\mathsf{T}\mu=10-2(14)+18=0\). These means rise at a constant rate across the three occasions, so there is no quadratic curvature.

For means \(10,15,12\), the linear contrast is \(-10+12=2\), while the quadratic contrast is \(10-2(15)+12=-8\). The negative quadratic value reflects a profile that bends downward relative to a straight-line pattern.

Worked Example: Four Occasions and a Linear Slope

For four equally spaced occasions, the centered coordinates are \((-1.5,-0.5,0.5,1.5)\). Convenient mutually orthogonal contrast vectors are \(q_1=(-3,-1,1,3)\), \(q_2=(1,-1,-1,1)\), and \(q_3=(-1,3,-3,1)\). Each sums to zero. For example, \(q_1^\mathsf{T}q_2=-3+1-1+3=0\), and \(q_1^\mathsf{T}q_3=3-3-3+3=0\); also \(q_2^\mathsf{T}q_3=-1-3+3+1=0\).

Let the means be \((12,15,19,24)\). The contrasts are

$$ q_1^\mathsf{T}\mu=-3(12)-15+19+3(24)=40, \qquad q_2^\mathsf{T}\mu=12-15-19+24=2, $$

and

$$ q_3^\mathsf{T}\mu=-12+3(15)-3(19)+24=0. $$

The positive linear component summarizes an upward trend; the small positive quadratic component describes a slight departure from a straight line, and the cubic component is zero. If the linear trend is expressed as the slope against the centered occasion coordinate \(x\), then \(q_1=2x\), and \(x^\mathsf{T}\mu=20\), \(x^\mathsf{T}x=5\). The least-squares linear slope is therefore \(20/5=4\) mean units per occasion step. The factor of two between \(q_1\) and \(x\) changes the contrast’s scale, not its trend pattern.

Worked Example: Five Occasions and a Pure Quadratic Profile

With five equally spaced occasions, centered coordinates are \((-2,-1,0,1,2)\). One mutually orthogonal set of contrast vectors is

$$ q_1=(-2,-1,0,1,2),\quad q_2=(2,-1,-2,-1,2),\quad q_3=(-1,2,0,-2,1),\quad q_4=(1,-4,6,-4,1). $$

Each sums to zero. Their pairwise inner products are zero: in order, \(q_1^\mathsf{T}q_2=0\), \(q_1^\mathsf{T}q_3=0\), \(q_1^\mathsf{T}q_4=0\), \(q_2^\mathsf{T}q_3=0\), \(q_2^\mathsf{T}q_4=0\), and \(q_3^\mathsf{T}q_4=0\). For example, \(q_2^\mathsf{T}q_4=2+4-12+4+2=0\).

Take means \(\mu=(4,7,8,7,4)\). The linear contrast is \(-8-7+0+7+8=0\). The quadratic contrast is \(q_2^\mathsf{T}\mu=8-7-16-7+8=-14\). The cubic contrast is \(4+14+0-14-4=0\), and the quartic contrast is \(4-28+48-28+4=0\). These means equal \(8-x_j^2\) at every occasion, so the profile is exactly quadratic. The contrast pattern isolates that curvature; the other polynomial components vanish.

What a Polynomial Contrast Measures

A contrast value is a signed combination of means, not a separate mean at an occasion. Its sign and size depend on the chosen coefficient orientation and scale. The shape of its coefficient vector gives its interpretation: linear coefficients compare early and late occasions in an ordered way; quadratic coefficients distinguish a bend from a straight trend; higher degrees represent progressively more complex departures.

The orthogonal vectors also give a coordinate representation of the profile. Suppose the mean vector has a representation \(\mu=\sum_{s=0}^{m}\beta_s q_s\), where \(m\le k-1\). Then each contrast \(q_r^\mathsf{T}\mu\) isolates one coefficient:

Result: If the mean vector is represented in mutually orthogonal vectors as \(\mu=\sum_{s=0}^{m}\beta_s q_s\), then for each \(r\le m\), \(\beta_r=(q_r^\mathsf{T}\mu)/(q_r^\mathsf{T}q_r)\).

Proof. Taking the inner product with \(q_r\) gives

$$ q_r^\mathsf{T}\mu =\sum_{s=0}^{m}\beta_s q_r^\mathsf{T}q_s =\beta_r q_r^\mathsf{T}q_r, $$

because mutual orthogonality makes every term with \(s\ne r\) zero. Since \(q_r\ne0\), its squared length \(q_r^\mathsf{T}q_r\) is positive, and division gives the stated coefficient. \(\square\)

The constant coordinate \(q_0\) represents the overall level. Since \(q_0\) is the vector of ones and each other \(q_r\) sums to zero, the coefficient of \(q_0\) is the average of the occasion means. The remaining coordinates describe the profile’s trend components around that level. With \(k\) occasions, the \(k-1\) contrast vectors span all possible mean-profile departures from a constant profile.

For observed data, replace the population means \(\mu_j\) with their estimated occasion means. The resulting contrast is an estimated trend component. Orthogonality here is a statement about the coefficient vectors under the ordinary inner product; by itself it does not guarantee that the estimated contrast values are statistically independent or uncorrelated. Those properties depend on the repeated-measure covariance structure.

Common Pitfalls

  • Using familiar coefficient patterns without checking the number of occasions. A three-occasion quadratic contrast does not automatically serve as the quadratic contrast for five occasions. Construct vectors for the actual occasion count.
  • Treating a contrast value as a slope. A contrast is a weighted sum. A slope requires a stated coordinate scale and an appropriate model or calculation; rescaling a contrast changes its numerical value.
  • Calling any orthogonal contrasts independent. Zero inner product of coefficient vectors is algebraic orthogonality, not a general guarantee about the sampling distribution.
  • Interpreting high-degree components as automatically meaningful trends. Higher-degree contrasts can represent complex profile departures, but their scientific usefulness depends on the planned question and the number and spacing of occasions.
Key takeaway: For equally spaced occasions, centered indices and discrete orthogonalization give a systematic set of planned polynomial contrasts. Their coefficient patterns describe linear, quadratic, and higher-order components of the repeated-measure mean profile, with scale and orientation chosen for convenient interpretation.

Check Your Understanding

Use the contrast definitions and calculations above to answer these questions.

  1. Why does every polynomial vector \(q_r\) with \(r\ge1\) have coefficients that sum to zero?
  2. For three equally spaced occasions, calculate the linear and quadratic contrasts for means \((9,13,11)\). What does each value indicate?
  3. Explain why multiplying a contrast vector by a nonzero constant does not change the trend pattern it represents.
  4. For a mean vector represented by orthogonal polynomial vectors, why does taking its inner product with \(q_r\) isolate the coefficient of \(q_r\)?
  5. Does orthogonality of two contrast coefficient vectors by itself imply that their estimated contrast values are uncorrelated? Explain.
Clinical Biostats