Why Construct a Contrast?
When a study has several groups and several measured outcomes, a single omnibus question—whether all group mean vectors are equal—may not be the scientific question of greatest interest. Researchers may want to compare a new treatment with a control, compare one group with the average of two others, or describe how a multivariate outcome changes across ordered doses. Each question selects a particular combination of group mean vectors. That combination is a planned multivariate group contrast.
The word “planned” matters: the comparison is specified from the study question, ideally before examining the outcome data. The contrast weights state precisely which groups are being compared and in what proportions. The resulting estimand is a vector, with one component for each response variable; it is not a separate comparison that must be invented for every response.
The zero-sum condition is essential. It ensures that the contrast compares group means rather than retaining an arbitrary common location shared by all groups. A positive weight gives a group a positive contribution; a negative weight gives it a negative contribution. Weights of the same sign can represent a group or average of groups on one side of a comparison, balanced by weights of the opposite sign on the other side.
Turning a Scientific Question Into Weights
Start by naming the group means that the question concerns. Then write the intended comparison as a weighted combination and check that its coefficients sum to zero. For example, “treatment A versus treatment B” has weights \(1\) and \(-1\). “The average of treatments A and B versus control” has weights \(1/2,1/2,-1\), assigned to A, B, and control respectively. The coefficients encode the comparison; their order must always match the order of the groups.
For \(q\) planned comparisons, place each comparison's \(g\) weights in one column of a matrix \(A\in\mathbb{R}^{g\times q}\). Let \(M\in\mathbb{R}^{p\times g}\) have the group mean vectors as its columns:
The \(j\)th column of \(A\) contains the weights for comparison \(j\), so the \(j\)th column of \(\Delta\) is its \(p\)-component contrast vector. The contrast condition is that every column of \(A\) sums to zero, or equivalently \(\mathbf{1}_g^{T}A=0\), where \(\mathbf{1}_g\) is a vector of \(g\) ones. This matrix notation organizes comparisons; it does not require all planned comparisons to be mutually unrelated or to have any special geometric relationship.
Worked Example: A Treatment Versus the Average of Two Alternatives
Three groups receive control, treatment A, or treatment B. Each group's mean vector records systolic blood pressure reduction and a symptom score, in that order: \(\mu_C=(2,1)^T\), \(\mu_A=(6,4)^T\), and \(\mu_B=(8,3)^T\). Construct the contrast “the average of A and B minus control.”
Assign weights in the order \(C,A,B\). The control has weight \(-1\), and each treatment has weight \(1/2\). The sum is \[ -1+\frac12+\frac12=0, \] so these weights define a contrast. The contrast vector is \[ \delta=-\mu_C+\frac12\mu_A+\frac12\mu_B. \] For the first response, the value is \(-2+\frac12(6)+\frac12(8)=5\). For the second response, it is \(-1+\frac12(4)+\frac12(3)=2.5\). Thus \(\delta=(5,2.5)^T\). In these response units, the average of the two treatment means is higher than the control mean by 5 units for the first response and 2.5 units for the second.
Worked Example: A Linear Trend Across Four Ordered Groups
Suppose four groups receive doses \(0,1,2,3\), and their mean vectors for two outcomes are \(\mu_0=(10,2)^T\), \(\mu_1=(12,3)^T\), \(\mu_2=(15,5)^T\), and \(\mu_3=(19,8)^T\). Use weights \((-3,-1,1,3)\) to construct a contrast that reflects an ordered linear trend.
First check the defining condition: \(-3-1+1+3=0\). The contrast is \[ \delta=-3\mu_0-\mu_1+\mu_2+3\mu_3. \] For outcome 1, the calculation is \(-3(10)-12+15+3(19)=-30-12+15+57=30\). For outcome 2, it is \(-3(2)-3+5+3(8)=-6-3+5+24=20\). Hence \(\delta=(30,20)^T\).
These coefficients are a conventional contrast for ordered, equally spaced groups, but the result is not itself a slope per dose unit. Dividing all four weights by 10 would produce \((-0.3,-0.1,0.1,0.3)\) and the vector \((3,2)^T\), a rescaled contrast. The scientific interpretation must therefore include the chosen scaling, not merely the sign of the result.
Worked Example: A Difference-in-Differences Across Responses
Consider four groups formed by two conditions (standard and enhanced) and two periods (before and after). Each group mean vector contains an outcome at period 1 and an outcome at period 2. Let their means, in the order standard-before, standard-after, enhanced-before, enhanced-after, be \(\mu_1,\mu_2,\mu_3,\mu_4\). The question is whether the change from period 1 to period 2 differs between conditions.
Within the standard condition the change is \(\mu_2-\mu_1\); within the enhanced condition it is \(\mu_4-\mu_3\). Subtract the standard change from the enhanced change: \[ \delta=(\mu_4-\mu_3)-(\mu_2-\mu_1) =\mu_1-\mu_2-\mu_3+\mu_4. \] Thus the weights in the stated group order are \((1,-1,-1,1)\), and they sum to \(1-1-1+1=0\). If the four means are respectively \((5,7)^T,(8,9)^T,(6,10)^T,(12,15)^T\), then the contrast equals \((5,7)^T-(8,9)^T-(6,10)^T+(12,15)^T=(3,3)^T\). It is a vector of differences in change, one for each response.
Two Useful Properties of Zero-Sum Weights
The zero-sum rule is more than a bookkeeping convention. It gives a contrast invariance to a common shift in all group means. It also means that any contrast can be understood as a combination of differences from a chosen reference group. These properties help check a proposed set of weights and explain what the resulting vector represents.
Proof. Under the common shift, the contrast becomes \[ \sum_{i=1}^{g}a_i(\mu_i+c) =\sum_{i=1}^{g}a_i\mu_i+\left(\sum_{i=1}^{g}a_i\right)c. \] If the weights sum to zero, the second term vanishes, so the contrast is unchanged. Conversely, suppose the contrast is unchanged for every \(c\). The displayed difference from the original contrast is \((\sum_i a_i)c\). Choosing any nonzero \(c\) forces \(\sum_i a_i=0\). Thus invariance for every common shift is equivalent to the contrast condition. \(\square\)
Derivation. Expand the right-hand side: \[ \sum_{i\ne r}a_i(\mu_i-\mu_r) =\sum_{i\ne r}a_i\mu_i-\left(\sum_{i\ne r}a_i\right)\mu_r. \] Because the weights sum to zero, \(\sum_{i\ne r}a_i=-a_r\). The expression is therefore \(\sum_{i\ne r}a_i\mu_i+a_r\mu_r\), which is exactly \(\sum_i a_i\mu_i\). \(\square\)
This representation does not make the chosen reference group part of the estimand. It is an algebraic way to express the same contrast using group differences. For example, a comparison may be written relative to control for convenience, while its definition remains the specified weighted combination.
Estimating the Contrast and Prespecifying It
Let \(\bar X_i\) be the sample mean vector in group \(i\). Replacing each population mean by its sample estimate gives the natural contrast estimate \[ \hat{\delta}=\sum_{i=1}^{g}a_i\bar X_i. \] If each group sample mean is unbiased for its population mean, then linearity of expectation gives \(E[\hat{\delta}]=\sum_i a_iE[\bar X_i]=\sum_i a_i\mu_i=\delta\). With multiple planned contrasts, the estimates are arranged as \(\hat{\Delta}=\bar X A\), where \(\bar X\) has the group sample means as columns. This construction defines the quantities to be estimated; it does not by itself specify an inferential procedure.
A comparison is prespecified when its scientific purpose and weights are chosen independently of the observed outcome values. The weights may be motivated by the study design, subject-matter knowledge, or a protocol. By contrast, if an analyst inspects the observed group means and then chooses whichever coefficients give the most striking contrast, the resulting comparison was selected using the data. It should not be treated as though those weights had been fixed in advance when making ordinary fixed-contrast inferential claims. The selection process affects the interpretation of uncertainty, so it must be acknowledged and handled by an appropriate method.
Prespecification does not mean that weights can never be revised for any reason. It means that the comparison being reported as planned must genuinely have been determined without using the outcome values that it is then used to assess. If a scientific question changes after seeing results, describe the resulting analysis as exploratory or data-selected rather than relabelling it as planned.
Common Mistakes and Practical Checks
- Weights do not sum to zero. For example, \((1,1,0)\) combines two means but does not compare them against another group. Revisit the question and balance the positive side with the intended comparison group or groups.
- Group order is inconsistent. A correct set of numbers paired with the wrong group order defines the wrong estimand. Write group labels above the weights before calculating.
- Averaging groups unintentionally changes the question. Weights \((1,1,-2)\) compare the sum of two means with twice the third; weights \((1/2,1/2,-1)\) compare their average with the third. Both sum to zero, but they have different scales.
- Unequal sample sizes are used as contrast weights automatically. A contrast concerns the population mean vectors specified by the scientific question. Sample sizes affect estimation and its uncertainty, but they do not automatically determine the contrast coefficients.
- A data-selected comparison is described as planned. Choosing weights after inspecting the outcomes changes the status of the analysis. Report how the comparison was chosen and do not ignore the selection when drawing inferential conclusions.
Check Your Understanding
For each question, identify the contrast weights or explain the relevant principle.
- For groups A, B, and control, write weights for “the average of A and B minus control,” in that order, and verify their sum.
- Why does adding the same vector to every group mean leave a valid contrast unchanged?
- For four groups with weights \((1,-1,-1,1)\), state the zero-sum check and explain how the contrast can be read as a combination of group differences.
- If all contrast weights are multiplied by 2, what happens to the contrast vector and its interpretation?
- An analyst chooses coefficients after examining which combination of group means looks most favorable. Why should that comparison not be presented as prespecified?