Tutorials › Multivariate Statistics (Graduate) › Contrasts for Unequally Spaced Measurement Times

Contrasts and Repeated Measures · Tutorial 369 of 975

Contrasts for Unequally Spaced Measurement Times

Build orthogonal trend contrasts from the actual measurement times, and interpret their coefficients without confusing them with occasion-based trends.

Advanced 10 min read

What You'll Learn

  • Center time values to construct the linear trend contrast.
  • Orthogonalize higher powers of time against lower-degree columns.
  • Verify contrast sums and pairwise inner products.
  • Interpret coefficients for an orthogonalized polynomial basis.
  • Explain how irregular spacing changes estimated linear trend summaries.
  • Distinguish a contrast value from its basis coefficient.

Why Measurement Times Matter

A trend across repeated measurements is not automatically a trend across equally spaced occasions. If measurements occur at days 0, 1, 3, and 6, then treating them as occasions 1, 2, 3, and 4 changes the time scale. The distinction matters: a linear coefficient based on actual time describes change per time unit, while one based on occasion number describes change per occasion. For higher-degree trends, the spacing also changes the contrast vectors themselves.

The construction here starts with the actual measurement times, forms columns of their powers, and orthogonalizes those columns across the observed occasions. The inner product gives each occasion equal weight; it does not account for measurement covariance or assign extra weight to intervals according to their duration.

Constructing Time-Based Orthogonal Contrasts

Definition: Suppose there are \(k\) distinct measurement times \(t_1,\ldots,t_k\), with corresponding occasion means collected in \(\mu=(\mu_1,\ldots,\mu_k)'\). A contrast vector is a vector \(c\in\mathbb{R}^k\) such that \(c'\mathbf{1}=0\), where \(\mathbf{1}\) is the vector of ones. Its contrast value is \(c'\mu\). Two vectors are orthogonal when their ordinary Euclidean inner product is zero.

For each degree \(j\), let \(z_j=(t_1^j,\ldots,t_k^j)'\), with \(z_0=\mathbf{1}\). Apply Gram–Schmidt in degree order. Start with \(c_0=\mathbf{1}\), and for \(j\geq 1\) define

$$ c_j=z_j-\sum_{r=0}^{j-1}\frac{c_r'z_j}{c_r'c_r}c_r. $$

This formula subtracts from the raw degree-\(j\) time column its projections onto all earlier columns. Use it only when the resulting \(c_j\) is nonzero. With \(k\) distinct times, the polynomial columns through degree \(k-1\) are linearly independent, so the construction produces nonzero vectors for those degrees. In particular, each \(c_j\), \(j\geq1\), is a contrast: it is orthogonal to \(c_0=\mathbf{1}\).

Important convention: This orthogonalization uses the ordinary inner product across the \(k\) occasions. It is not a covariance-weighted orthogonalization. Multiplying a contrast vector by a nonzero constant leaves it a contrast and preserves its orthogonality, but generally changes its associated coefficient inversely; a zero coefficient remains zero.

Why the Construction Works

Result: The vectors \(c_0,c_1,\ldots,c_m\) produced by the construction are pairwise orthogonal, provided each required residual is nonzero. For \(j\geq1\), \(c_j\) sums to zero.

To prove the result, suppose \(c_0,\ldots,c_{j-1}\) are nonzero and pairwise orthogonal. For any \(s<j\), take the inner product of \(c_s\) with the defining expression for \(c_j\):

$$ c_s'c_j =c_s'z_j-\sum_{r=0}^{j-1}\frac{c_r'z_j}{c_r'c_r}c_s'c_r =c_s'z_j-\frac{c_s'z_j}{c_s'c_s}c_s'c_s =0. $$

In the second equality, pairwise orthogonality makes every term with \(r\ne s\) vanish. Thus \(c_j\) is orthogonal to every preceding vector. Taking \(s=0\) gives \(\mathbf{1}'c_j=0\), the contrast condition. The initial vector \(c_0\) is nonzero, so induction proves the claim for every constructed vector. \(\square\)

The orthogonalization also preserves polynomial degree: \(c_j\) is \(z_j\) minus a combination of columns of lower degree. Consequently, \(c_0,\ldots,c_j\) span the same occasion-wise columns as \(z_0,\ldots,z_j\). When the profile is exactly a polynomial of degree at most \(m\), it can therefore be expressed in the orthogonal basis:

$$ \mu=\sum_{r=0}^{m}\gamma_r c_r, \qquad \gamma_j=\frac{c_j'\mu}{c_j'c_j}. $$

The coefficient formula follows by taking the inner product with \(c_j\): orthogonality leaves \(c_j'\mu=\gamma_j c_j'c_j\). These \(\gamma_j\) are coefficients for the chosen orthogonal basis. They are not the raw contrast values \(c_j'\mu\), nor are they automatically coefficients for a different basis or time scale.

Worked Constructions and Interpretations

Worked Example: Linear and Quadratic Contrasts at Unequal Times

Suppose measurements are taken at times \(0,2,6,12\). Construct the linear and quadratic contrasts by orthogonalizing the time columns. The centered linear column is

Linear column. The mean time is \(5\), so \(c_1=(-5,-3,1,7)'\). Its entries sum to zero and \(c_1'c_1=25+9+1+49=84\).

Quadratic column. The time squares are \((0,4,36,144)'\), with mean \(46\). Centering gives \(w=(-46,-42,-10,98)'\). Its projection coefficient onto \(c_1\) is

$$ \frac{c_1'w}{c_1'c_1} =\frac{230+126-10+686}{84} =\frac{1032}{84} =\frac{86}{7}. $$

Subtract that projection:

$$ c_2=w-\frac{86}{7}c_1 =\frac{1}{7}(-322,-84,-156,42)'. $$

Check the arithmetic and orthogonality directly: the entries of \(c_2\) sum to zero, and \(c_1'c_2=1610+252-156+294=2000\) would not be zero—so this expression signals an error if used as written. Recomputing the projection numerator gives \(230+126-10+686=1032\), and \(1032/84=86/7\); the subtraction componentwise is \(c_2=(-46,-42,-10,98)'-(-430/7,-258/7,86/7,602/7)'\) \(=(108/7,-36/7,-156/7,84/7)'=(12/7)(9,-3,-13,7)'\). Now the sum is \(0\), and its inner product with \(c_1\) is \((-5)(108/7)+(-3)(-36/7)+(1)(-156/7)+(7)(84/7)=0\). The corrected vector is the quadratic contrast.

Coefficient check. Consider the profile \(\mu_i=10+2t_i+t_i^2/8\), which gives \(\mu=(10,14.5,26.5,52)'\). Since its quadratic coefficient is \(1/8\), the orthogonal-basis coefficient for \(c_2\) must also be \(1/8\): the raw square column differs from \(c_2\) only by components in the span of the constant and linear columns. Directly, \(c_2'\mu=(12/7)(90-43.5-344.5+364)=792/7\), and \(c_2'c_2=(144/49)(308)=6336/7\), so \(c_2'\mu/(c_2'c_2)=1/8\).

Worked Example: A Three-Time Quadratic Contrast

Take measurement times \(0,1,3\). Their mean is \(4/3\), so the linear contrast is \(c_1=(-4/3,-1/3,5/3)'\). The centered square column is \(w=(-10/3,-7/3,17/3)'\). Its projection coefficient onto \(c_1\) is

$$ \frac{c_1'w}{c_1'c_1} =\frac{44/3}{14/3} =\frac{22}{7}. $$

Subtracting this projection gives

$$ c_2=w-\frac{22}{7}c_1 =\left(\frac{6}{7},-\frac{9}{7},\frac{3}{7}\right)' =\frac{3}{7}(2,-3,1)'. $$

The entries sum to zero. The inner product with the linear contrast is \((-4/3)(6/7)+(-1/3)(-9/7)+(5/3)(3/7)=(-24+9+15)/21=0\). Thus this quadratic contrast is orthogonal to both the constant column and the linear trend column. Its direction is unchanged if it is rescaled, but its coefficient in an expansion changes with that scaling.

Worked Example: Occasion Trend Versus Time Trend

Suppose the measurement times are \(0,1,3,6\), and the observed occasion means are \(\mu=(10,12,14,20)'\). A linear projection on actual time uses centered times \((-2.5,-1.5,0.5,3.5)'\). The mean response is \(14\), so centered responses are \((-4,-2,0,6)'\). The coefficient of the centered-time column is

$$ \frac{(-2.5)(-4)+(-1.5)(-2)+(0.5)(0)+(3.5)(6)} {(-2.5)^2+(-1.5)^2+(0.5)^2+(3.5)^2} =\frac{34}{21}\approx1.619. $$

This is the least-squares linear trend per time unit across these four equally weighted occasion means. If instead the same means are treated as equally spaced occasions numbered \(0,1,2,3\), the centered occasion scores are \((-1.5,-0.5,0.5,1.5)\). Their dot product with the centered responses is \(6+1+0+9=16\), and their squared length is \(5\), giving a coefficient \(16/5=3.2\) per occasion. The different values do not conflict: they summarize different predictors and answer different questions.

What the Coefficients Mean

Orthogonalizing time powers is a systematic way to define degree-specific contrast directions. The degree-one direction measures linear variation with actual time after removing the constant level. The degree-two direction measures the part of the squared-time pattern not already explained by the constant and linear directions. Higher degrees follow the same logic: each new direction captures what its raw time power adds beyond lower degrees.

For an exactly polynomial profile, the coefficient of a monic orthogonalized degree-\(j\) column agrees with the coefficient of \(t^j\) in the raw polynomial. This is because the column is \(z_j\) plus lower-degree terms, and rewriting the polynomial in the orthogonal basis does not change its leading-degree coefficient. However, the coefficient is tied to the chosen time units: changing days to hours changes numerical polynomial coefficients. If a contrast vector is rescaled, the corresponding orthogonal-basis coefficient changes inversely. In particular, replacing \(c_j\) by \(a c_j\) gives coefficient \((a c_j)'\mu/((a c_j)'(a c_j))=\gamma_j/a\); when \(\gamma_j=0\), it remains zero.

For profiles that are not exactly polynomial, these coefficients describe the ordinary least-squares projection of the occasion means onto the selected polynomial columns, with each occasion counted once. They are not automatically summaries of continuous change between measurements, and the unobserved portions of a profile are not determined by the occasion means alone.

Common Pitfalls

  • Using occasion number when actual time is intended. That constructs a trend over the order of measurements, not a trend per unit of elapsed time. State which predictor defines the trend.
  • Calling a raw power column a contrast. A contrast must sum to zero. Centering removes its constant component; higher-degree columns also need their projections on lower-degree columns removed if an orthogonal contrast basis is desired.
  • Assuming orthogonality means independence. The construction establishes zero ordinary inner products among occasion-space vectors. It does not establish stochastic independence of contrast scores.
  • Confusing contrast value and coefficient. The contrast value is \(c_j'\mu\); the coefficient in the orthogonal expansion is \(c_j'\mu/(c_j'c_j)\). Their numerical values generally differ.
  • Interpreting an arbitrary scale as intrinsic. Rescaling a basis vector changes its coefficient inversely. Report the time units and basis convention when comparing numerical coefficients.
Key takeaway: Build trend contrasts from the actual measurement times, orthogonalize each power against all lower-degree columns, and interpret the resulting coefficients relative to that time scale and basis. Unequal spacing changes the contrast directions and the trend summary.

Check Your Understanding

Work through these questions using the definitions and construction above.

  1. For distinct measurement times, why does every nonconstant Gram–Schmidt residual in the construction sum to zero?
  2. For times \(0,1,3\), verify that \((2,-3,1)'\) is orthogonal to the linear contrast \((-4/3,-1/3,5/3)'\).
  3. Explain why a linear coefficient based on actual elapsed time need not equal a coefficient based on occasion number.
  4. If \(c_j\) is replaced by \(4c_j\), how does its contrast value change, and how does its orthogonal-basis coefficient change?
  5. What does the ordinary inner product across occasions imply about weighting, and what does it not imply about the covariance of repeated measurements?
Clinical Biostats