From a Scientific Question to an Interaction Contrast
In a multi-condition study, an overall difference can conceal the question that matters: does the effect of one condition depend on another condition? For example, a treatment may change expression in one biological group but not another. Planning this comparison means specifying the response scale, the condition-specific effects to compare, and the combinations of conditions that must be represented in the study.
The introductory material on factorial designs establishes how combinations of factor levels define groups. Here the focus is narrower: turning a scientific question about differences between effects into coefficients that can be estimated from those groups.
A contrast is an estimand: a precise population quantity that the design is meant to estimate. Its coefficients encode the scientific comparison. An interaction contrast compares condition effects across levels of another factor. For two levels of each factor, let A be control (\(a=0\)) or treatment (\(a=1\)), and let B have levels \(b=0\) and \(b=1\). The treatment effect at B level \(b\) is \(\delta_b=\mu_{1b}-\mu_{0b}\). The interaction contrast is the difference between those effects:
The four coefficients are \(+1,-1,-1,+1\), which sum to zero. In addition, their sums within each A level and within each B level are zero. This cancellation is what makes the contrast a comparison of condition effects rather than a general shift in the response across one factor.
The contrast is defined on the chosen scale. A difference-in-differences in log expression units is not the same estimand as a difference-in-differences in expression counts or fold changes. State the scale before interpreting the coefficients.
Building Coefficients From the Target Comparison
A reliable construction is to write the condition-specific effect first, then compare those effects. If the question is whether treatment has a different effect at \(B=1\) than at \(B=0\), write \(\delta_1-\delta_0\) and expand each \(\delta\) into cell means. This guards against reversing signs or accidentally comparing cell means that do not represent the intended effects.
With more than two levels of B, the question may compare one condition effect with a weighted average of effects at other B levels. The weights should reflect the target comparison, not merely whatever group sizes happen to arise in the data. For a weighted average, use weights that sum to one. The resulting interaction contrast still compares effects and has coefficients summing to zero.
Worked Example: Treatment Effects Differ Between Two Groups
Suppose a hypothetical study plans to compare treatment and control in two biological groups. The response is mean donor-level log2 normalized expression for a specified gene. The planned cell means, in log2 units, are \(\mu_{00}=2.0\) (control, group 0), \(\mu_{10}=2.4\) (treatment, group 0), \(\mu_{01}=1.5\) (control, group 1), and \(\mu_{11}=2.6\) (treatment, group 1). The study recruits six independent donors per combination.
The treatment effect in group 0 is \(2.4-2.0=0.4\) log2 units. In group 1 it is \(2.6-1.5=1.1\) log2 units. Thus the planned interaction contrast is
Equivalently, \(\widehat L=2.6-1.5-2.4+2.0=0.7\). The estimated treatment effect is 0.7 log2 units larger in group 1 than in group 0. This is a comparison of mean responses on the log2 scale; it does not, by itself, establish why the difference occurs.
For illustration, suppose the donor-level sample standard deviations in the four groups, in the same order as \(\mu_{00},\mu_{10},\mu_{01},\mu_{11}\), are \(0.3,0.4,0.5,0.4\) log2 units. If donor observations are independent across groups, a plug-in standard error is the square root of the sum of each cell-mean variance multiplied by the squared contrast coefficient:
This calculation uses independent donor groups and the usual sample-variance estimates for the cell means. If conditions are paired within donors, the covariance between paired measurements must instead be included; treating paired observations as independent would give the wrong standard error. The example identifies the target and its precision calculation, not a significance conclusion.
Which Combinations Must Be Represented?
Once the coefficients are written, their nonzero entries show which cell means enter the contrast directly. Those combinations must be represented to estimate that contrast from observed cell means. This is a necessary planning check, not a guarantee of adequate precision: each combination also needs enough independent experimental units for the intended analysis. In single-cell studies, having many cells from a donor does not replace independent donors when the target concerns variation across donors.
A zero coefficient means that the corresponding cell mean does not enter this particular contrast. It does not mean that the factor level is scientifically irrelevant to every other question, nor that a study can support conclusions about it without observations. Conversely, if a nonzero-coefficient combination is absent, the stated contrast cannot be calculated directly from the observed cell means without adding assumptions or changing the estimand.
Worked Example: Comparing One Effect With a Weighted Average
Consider three levels of B. A hypothetical study targets the treatment effect at \(B=1\) minus a weighted average of effects at \(B=2\) and \(B=3\), using weights 0.4 and 0.6. Suppose the mean responses in log2 units are:
| B level | Control mean | Treatment mean | Treatment effect |
|---|---|---|---|
| 1 | 1.0 | 1.2 | 0.2 |
| 2 | 1.1 | 1.9 | 0.8 |
| 3 | 0.7 | 1.2 | 0.5 |
Writing the target in terms of effects gives \(L=\delta_1-0.4\delta_2-0.6\delta_3\). Since \(\delta_b=\mu_{1b}-\mu_{0b}\), its cell-mean form is
The treatment coefficients sum to \(1-0.4-0.6=0\), and the control coefficients sum to \(-1+0.4+0.6=0\). The full set of coefficients therefore sums to zero. Substitution gives
The estimated treatment effect at \(B=1\) is 0.42 log2 units below the weighted average effect at \(B=2\) and \(B=3\). All six treatment-by-B combinations enter with nonzero coefficients, so each must be represented for this contrast. The weights define the target; they should not be replaced by sample-size proportions unless those proportions are explicitly part of the scientific estimand.
Worked Example: A Targeted Interaction Does Not Require Every Factor Level
A second hypothetical study has three B levels but its prespecified question is whether treatment effects differ between \(B=1\) and \(B=3\). The study does not target \(B=2\). Suppose the control and treatment means are 4.0 and 4.5 at \(B=1\), and 3.0 and 4.2 at \(B=3\), respectively, in a chosen response unit.
The effect at \(B=1\) is \(4.5-4.0=0.5\) units; the effect at \(B=3\) is \(4.2-3.0=1.2\) units. The contrast is
Only the four treatment-by-B combinations for \(B=1\) and \(B=3\) have nonzero coefficients in this contrast. They are the combinations needed to estimate this targeted comparison; observations at \(B=2\) are not required for its direct calculation. However, this design cannot answer a broader question comparing treatment effects across all three B levels. The design must represent the scientific target, not simply a generic label such as “interaction.”
Justification, Assumptions, and Design Checks
For independent groups, the standard error formula follows from variance rules. Let \(\bar Y_{ab}\) be the sample mean in cell \((a,b)\), based on \(n_{ab}\) independent experimental units, with variance \(\sigma^2_{ab}\). The estimate is \(\widehat L=\sum c_{ab}\bar Y_{ab}\). Independence makes the covariance terms zero, so the variance of the weighted sum is the sum of the variances multiplied by squared coefficients:
Replacing each \(\sigma^2_{ab}\) with an appropriate within-cell variance estimate yields the plug-in standard error used above. With paired or otherwise dependent observations, covariance terms generally do not vanish, so this independent-groups expression is not appropriate.
Planning and interpreting the contrast require several conditions to be explicit:
- The response and scale are defined. Cell means must refer to the same outcome definition and scale. A contrast on log expression is interpreted in log units, not as a raw-count difference.
- The target population and experimental unit are clear. The cell means describe the target units, such as donors, under the stated sampling and assignment plan. Cells from the same donor are not automatically independent experimental units.
- The contrast is fixed by the scientific question. Coefficients and any averaging weights should be chosen before inspecting results, rather than selected to maximize an observed difference.
- The combinations in the contrast are observed. Every cell mean with a nonzero coefficient needs data. Adequate numbers of independent units are also needed for useful precision.
- The sampling or dependence structure matches the calculation. Independent-group formulas require independent units across the groups; repeated measurements require an analysis that reflects their dependence.
A practical diagnostic is to create a table of the planned factor combinations and mark the contrast coefficients beside them. Check that every required combination appears and that the labels and signs agree with the written scientific question. Then check the number of independent units—not just the number of cells—in each combination. Very unequal group sizes may leave the contrast mathematically definable while making its uncertainty much larger than expected.
Alternatives, Pitfalls, and Limitations
An interaction contrast answers a specific comparison of effects. It differs from an omnibus interaction test, which assesses a broader collection of interaction departures without identifying just one weighted comparison. It also differs from reporting separate treatment effects within each B level: those simple effects describe the component effects, while the interaction contrast directly estimates their difference. Reporting only an overall treatment effect can obscure effect variation across B levels, especially when that overall effect averages across groups.
These approaches are complementary, not interchangeable. If the scientific question concerns one prespecified difference in effects, the corresponding contrast is direct and interpretable. If the question concerns whether any interaction exists across several levels, a broader test may be appropriate. Separate contrasts for many comparisons can create a multiplicity burden, and results should not be treated as though only one comparison had been planned. The choice of response scale also matters: an interaction on an additive scale need not be an interaction on a ratio or log scale.
Common mistake: “The treatment effect is significant in group 1 but not significant in group 0, so the treatment effects differ.” This reasoning compares two separate significance decisions, not the effects themselves. One estimate can be more precise than the other even when the underlying effects are equal. The correction is to define and estimate the difference between effects directly, such as \((\mu_{11}-\mu_{01})-(\mu_{10}-\mu_{00})\), and quantify uncertainty for that contrast.
A contrast also cannot compensate for an unrepresentative recruitment plan, poor measurement, or insufficient independent replication. Its numerical value is conditional on the chosen outcome scale, target population, and weights. State those choices so readers can tell what comparison the estimate supports and what comparisons remain outside its scope.
Check Your Understanding
For each question, identify the estimand or design implication. Solutions follow the questions.
- For two A levels and two B levels, write the interaction contrast comparing the A effect at \(B=1\) with the A effect at \(B=0\).
- A planned contrast has coefficients \(1,-1,1,-1\) across four cell means. Is it a linear contrast? What additional check is needed before calling it an interaction contrast?
- A study targets the treatment effect at \(B=2\) minus the treatment effect at \(B=1\). Which treatment-by-B combinations must be observed directly?
- Why can “significant at one B level, not significant at another” fail to establish an interaction?
Solutions. (1) With A levels 0 and 1, the contrast is \((\mu_{11}-\mu_{01})-(\mu_{10}-\mu_{00})=\mu_{11}-\mu_{01}-\mu_{10}+\mu_{00}\). (2) The coefficients sum to zero, so it is a linear contrast. To describe it as an interaction contrast, check that it compares A effects across B levels—for this two-by-two layout, coefficients must cancel within each A and B margin in the intended difference-in-differences pattern. (3) The control and treatment combinations at both \(B=1\) and \(B=2\) are needed: four combinations in total. (4) Separate significance decisions do not test the difference between effects. Estimate the difference directly and assess its uncertainty.