Tutorials › VEE Mathematical Statistics › Designing Planned Contrasts

VEE Mathematical Statistics · ANOVA Contrasts and Comparisons · Tutorial 820 of 880

Designing Planned Contrasts

Build coefficient vectors that express the scientific comparison you intend to make, and check that each vector defines the right contrast.

Advanced 9 min read

What You'll Learn

  • Translate a control-versus-treatment question into coefficients for a contrast.
  • Construct coefficients to compare one treatment with the average of the others.
  • Compare two sets of treatments while making the averaging convention explicit.
  • Recognize when coefficient scaling changes units but not the underlying comparison.
  • Check a contrast for a zero coefficient sum and calculate its estimated standard error.

Introduction: Begin With the Question

An ANOVA study may include several groups, but its scientific question is often more specific than “are any group means different?” A researcher might want to compare a control with the average response across treatments, isolate one treatment from the others, or compare two sets of treatments. Each question calls for a planned contrast: a particular linear combination of the group means chosen to represent the comparison of interest.

The key design decision is not merely which coefficients make a valid contrast. It is what quantity those coefficients are intended to measure. A coefficient vector should make that quantity explicit, including which groups are being averaged and whether the comparison is directional. The same comparison can be written with different coefficient scales, so interpreting the scale is part of the work.

Definition: For \(k\) group means \(\mu_1,\ldots,\mu_k\), a linear contrast is \(L=\sum_{i=1}^{k}c_i\mu_i\), where the coefficients are fixed in advance and satisfy \(\sum_{i=1}^{k}c_i=0\). The coefficients \(c_i\) specify the comparison. Replacing all of them by the same nonzero multiple changes the scale of \(L\), but not the underlying comparison.

A coefficient sum of zero removes any common level shared by all group means. For example, adding the same constant to every \(\mu_i\) leaves \(L\) unchanged. A planned contrast is specified from the scientific question, preferably before examining the group outcomes. Choosing a comparison after seeing which groups look different can make its interpretation and subsequent inference less straightforward.

A Practical Method for Designing Coefficients

1
Name the target.
Write the comparison in words: for example, “the average of the three treatments minus the control.”
2
Choose the averaging rule.
Decide whether each treatment group receives equal weight in its set average, or whether a different scientifically justified weighting is intended.
3
Put the target into algebra.
Express the comparison as a linear combination of the group means and read off the coefficients in the stated group order.
4
Check the contrast and its scale.
Verify that the coefficients sum to zero. State whether the result is a difference of means or a scaled version of that difference.

For example, comparing the average of \(r\) treatment means with a control mean gives the target \(\frac{1}{r}\sum_{i=1}^{r}\mu_i-\mu_0\). The treatment coefficients are \(1/r\), and the control coefficient is \(-1\). Multiplying every coefficient by \(r\) gives an equivalent contrast with treatment coefficients \(1\) and control coefficient \(-r\). That second version is often easier to write, but its contrast value is \(r\) times the difference of means.

Worked Contrast Designs

Worked Example: A Control Versus the Average of Three Treatments

A hypothetical study compares a control formulation with three treatment formulations, labeled A, B, and C. The group order is control, A, B, C. The observed means are 12, 15, 18, and 21 units, respectively. There are 10 independent observations in each group, and the pooled ANOVA mean square error is \(MSE=9\). Design and estimate the contrast “average treatment response minus control,” and calculate its estimated standard error.

Method and target. There are three treatments, so the target is \((\mu_A+\mu_B+\mu_C)/3-\mu_{\text{control}}\). In the stated group order, one coefficient vector is \((-1,1/3,1/3,1/3)\). Its coefficient sum is \(-1+1/3+1/3+1/3=0\).

Equivalent convenient scale. Multiplying every coefficient by 3 gives \((-3,1,1,1)\). This is still a valid contrast, but it measures three times the stated difference. The coefficient sum is \(-3+1+1+1=0\).

Estimate on the convenient scale. Substituting the observed means gives \(-3(12)+15+18+21=-36+54=18\). Divide by 3 to return to the requested difference: \(18/3=6\) units. Directly, the treatment average is \((15+18+21)/3=54/3=18\), and \(18-12=6\).

Estimated standard error. Under the one-way ANOVA model with independent observations and a common within-group variance, the estimated variance of a contrast estimate is \(MSE\sum_i c_i^2/n_i\). Using the normalized coefficients gives \(9[(1/10)+(1/9)(1/10+1/10+1/10)]=9[1/10+1/30]=9(2/15)=1.2\). Thus the estimated standard error is \(\sqrt{1.2}\approx1.095\) units.

Check and trap avoided. The estimate is positive because the treatment average, 18, exceeds the control mean, 12. The incorrect vector \((-1,1,1,1)\) sums to 2, so it is not a contrast and does not represent the treatment average minus control. The corrected coefficients must account for averaging the three treatment means.

Worked Example: One Treatment Versus the Average of the Others

A hypothetical four-arm study has means \(\mu_A,\mu_B,\mu_C,\mu_D\), in that order. The observed means are 14, 20, 16, and 17 units. Each group has 6 independent observations, and \(MSE=4\). The planned question is whether treatment B differs from the average of A, C, and D. Construct and estimate the contrast, then find its estimated standard error.

Method and target. Write the question as \(\mu_B-(\mu_A+\mu_C+\mu_D)/3\). In the given group order, the coefficients are \((-1/3,1,-1/3,-1/3)\), which sum to \(-1/3+1-1/3-1/3=0\). To avoid fractions, use the equivalent vector \((-1,3,-1,-1)\).

Estimate. On the convenient scale, the estimate is \(-14+3(20)-16-17=-14+60-16-17=13\). The target as written is the unscaled difference, so divide by 3: \(13/3\approx4.333\) units. Checking by averaging the other treatments gives \((14+16+17)/3=47/3\), and \(20-47/3=(60-47)/3=13/3\).

Estimated standard error. Use the normalized coefficients, whose squared values sum to \(1/9+1+1/9+1/9=4/3\). With \(n_i=6\), the estimated variance is \(4(4/3)/6=8/9\), so the estimated standard error is \(\sqrt{8/9}\approx0.943\) units.

Check and trap avoided. The estimated difference is positive, consistent with B’s mean of 20 being above the average of the other three means. The vector \((-1,1,-1,-1)\) would give the B coefficient only 1, rather than 3 on the convenient scale; its sum is \(-2\), so it fails the contrast check and does not encode the intended average.

Worked Example: Comparing Two Sets of Treatments

A hypothetical study compares two sets of formulations. Set 1 contains A and B; Set 2 contains C, D, and E. The group order is A, B, C, D, E. Their observed means are 10, 14, 16, 19, and 20 units. Sample sizes are 4, 4, 6, 6, and 6, and \(MSE=9\). Compare the equally weighted average of the three means in Set 2 with the equally weighted average of the two means in Set 1. Estimate the contrast and its standard error.

Method and target. The target is \((\mu_C+\mu_D+\mu_E)/3-(\mu_A+\mu_B)/2\). The corresponding coefficients are \((-1/2,-1/2,1/3,1/3,1/3)\). Their sum is \(-1/2-1/2+1/3+1/3+1/3=0\).

Estimate. Set 1’s average is \((10+14)/2=24/2=12\). Set 2’s average is \((16+19+20)/3=55/3\approx18.333\). The estimated contrast is \(55/3-12=(55-36)/3=19/3\approx6.333\) units.

Estimated standard error. The sum of squared coefficients divided by sample sizes is \((1/4)/4+(1/4)/4+(1/9)/6+(1/9)/6+(1/9)/6\). The first two terms total \(1/16+1/16=1/8\); the last three total \(3/54=1/18\). Thus the sum is \(1/8+1/18=9/72+4/72=13/72\). The estimated variance is \(9(13/72)=13/8=1.625\), and the estimated standard error is \(\sqrt{13/8}\approx1.275\) units.

Check and trap avoided. The estimate is positive because 18.333 is greater than 12. The coefficients express equal weighting of the treatment means within each set. Weighting groups by their sample sizes instead would define a different target; it is not automatically the right choice just because the group sizes differ.

Why These Coefficients Give the Standard Error

The coefficient vector defines the estimate as well as the population contrast. Let \(\bar{Y}_i\) be the sample mean in group \(i\), so the estimated contrast is \(\hat{L}=\sum_i c_i\bar{Y}_i\). For the standard one-way ANOVA model, assume independent observations, normally distributed errors with mean zero, and a common variance \(\sigma^2\) in every group. Then each group mean has variance \(\sigma^2/n_i\), and different group means are independent.

The variance of a sum of independent random variables is the sum of their variances after each is multiplied by the square of its coefficient. Therefore,

$$ \operatorname{Var}(\hat{L}) =\operatorname{Var}\!\left(\sum_i c_i\bar{Y}_i\right) =\sum_i c_i^2\operatorname{Var}(\bar{Y}_i) =\sigma^2\sum_i\frac{c_i^2}{n_i}. $$

The ANOVA pooled mean square error estimates the common variance \(\sigma^2\). Substituting \(MSE\) for \(\sigma^2\) gives the estimated variance used in the examples. If all coefficients are multiplied by a constant \(a\), the estimate is multiplied by \(a\), and its standard error is multiplied by \(|a|\). Thus changing coefficient scale does not change the standardized test statistic, provided the estimate and standard error use the same scale.

Design Checks and Common Traps

Before using a planned contrast, make the coefficient interpretation explicit. The zero-sum condition is necessary, but it does not guarantee that the coefficients answer the intended scientific question. In particular, treatment-set comparisons require an explicit averaging rule, and coefficient signs must match the direction stated in the question.

  • Forgetting the size of an average. Comparing a control with the average of three treatments requires either \((-1,1/3,1/3,1/3)\) or a proportional vector such as \((-3,1,1,1)\). Giving the control and all three treatments coefficients with magnitude 1 does not form that contrast.
  • Changing the target by pooling observations. An equal average of two treatment means gives each mean weight \(1/2\), even if the sample sizes differ. Weighting by sample size instead targets a pooled-observation average, which is a different estimand.
  • Reversing the direction. “Treatment minus control” and “control minus treatment” are negatives of one another. The magnitude is the same, but the sign and interpretation are reversed.
  • Confusing validity with scientific relevance. Many coefficient vectors sum to zero. Choose the one whose linear combination states the prespecified comparison, rather than selecting coefficients only because they satisfy the algebraic condition.

A planned contrast can be part of a set of several questions, and its coefficients need not be orthogonal to those of another contrast. Planning clarifies what each question measures; it does not by itself remove issues that arise from conducting many tests.

Key takeaway: Translate the question into an explicit difference of group means, read off the coefficients, and verify that they sum to zero. State the averaging convention and coefficient scale so the contrast estimate has an unambiguous interpretation.

Check Your Understanding

For each situation, write coefficients in the group order given and interpret the contrast. Answers use the stated difference direction.

  1. A control and two treatments A and B are ordered control, A, B. Write a contrast for the average of A and B minus control. (Answer: \((-1,1/2,1/2)\), or any nonzero multiple such as \((-2,1,1)\).)
  2. Four treatments A, B, C, and D are ordered as listed. Write a contrast for D minus the average of A, B, and C. (Answer: \((-1/3,-1/3,-1/3,1)\), or the proportional vector \((-1,-1,-1,3)\).)
  3. Five groups are ordered A, B, C, D, E. Compare the equally weighted mean of A and B with the equally weighted mean of C, D, and E, in the direction “first set minus second set.” (Answer: \((1/2,1/2,-1/3,-1/3,-1/3)\); the coefficients sum to zero.)
  4. A study has control, treatment A, and treatment B in that order. A candidate proposes \((-1,1,1)\) for “the average treatment minus control.” Identify the problem and give corrected coefficients. (Answer: The proposed coefficients sum to 1, so they do not define a contrast and do not encode the average; use \((-1,1/2,1/2)\) or \((-2,1,1)\).)
  5. Three treatment groups A, B, and C have sample sizes 5, 10, and 15. The target is the equally weighted average of the three treatment means minus a control mean, with the control listed first. Give the coefficients and explain why the unequal sample sizes do not change them. (Answer: \((-1,1/3,1/3,1/3)\); the target averages treatment means equally, while sample sizes affect precision rather than the specified contrast.)
Clinical Biostats