Tutorials › Regression Analysis (Undergraduate) › Adding a Treatment-by-Baseline Interaction

Regression in Randomized Studies · Tutorial 905 of 991

Adding a Treatment-by-Baseline Interaction

Specify an ANCOVA model with a treatment-by-baseline interaction and see how its product term permits treatment effects to vary with baseline outcome.

Intermediate 9 min read

What You'll Learn

  • Define the treatment indicator, baseline outcome, follow-up outcome, and error in an interaction ANCOVA model.
  • Construct the treatment-by-baseline product term from trial data.
  • Distinguish the interaction model from a common-slope ANCOVA model.
  • Derive how the model’s conditional treatment contrast depends on baseline outcome.
  • Recognize the assumptions and common specification errors involved in adding an interaction.

Why Add a Treatment-by-Baseline Interaction?

In a randomized study, ANCOVA relates a participant’s follow-up outcome to treatment assignment and a baseline outcome measured before treatment. A common-slope ANCOVA model assumes that the relationship between baseline and follow-up is the same in both treatment groups. That can be a useful, simple model, but it also imposes a restriction: the treatment contrast is the same at every baseline value.

A treatment-by-baseline interaction removes that restriction. It adds a product of the treatment indicator and baseline outcome to the model. The product lets the baseline-to-follow-up relationship differ by treatment group and, as a consequence, lets the modelled treatment contrast vary with baseline outcome. This tutorial focuses on specifying that model and identifying its terms.

Definition: Let \(Y_i\) be participant \(i\)'s follow-up outcome, \(T_i\) their randomized treatment assignment coded \(1\) for treatment and \(0\) for control, and \(X_i\) their baseline outcome. A linear ANCOVA model with a treatment-by-baseline interaction is $$ Y_i=\beta_0+\beta_1T_i+\beta_2X_i+\beta_3(T_iX_i)+\varepsilon_i. $$ The product \(T_iX_i\) is the interaction term. The coefficients \(\beta_0,\beta_1,\beta_2,\beta_3\) are model parameters, and \(\varepsilon_i\) is the error for participant \(i\).

Specify the Model Before Using It

The model describes the conditional mean of the follow-up outcome given assignment and baseline outcome, together with an error term. Its main effects are the treatment indicator \(T_i\) and baseline outcome \(X_i\); its interaction is their product \(T_iX_i\). Include both main effects when including their product. A product term alone would not represent the usual treatment-by-baseline interaction model.

The model is a reasonable starting specification when the conditional mean is approximately linear in baseline outcome within each treatment group over the baseline range being studied. It also assumes that treatment and baseline are coded and measured as intended, and that the recorded baseline value is genuinely measured before treatment. For standard regression-based inference, one commonly assumes errors have conditional mean zero, are independent across participants, and have a common variance. Normal errors are an additional assumption used for exact small-sample inference, not a requirement for defining the model. Random assignment supports comparisons by assigned group; it does not by itself guarantee that this particular linear conditional-mean form is adequate.

The baseline outcome is in its original units here. If, for example, \(X_i\) is a score in points, then the product \(T_iX_i\) also uses that score scale because \(T_i\) is a dimensionless zero-or-one indicator. Including randomization-stratum terms, when appropriate, is compatible with this interaction: those terms can be added to the model without changing the definition of \(T_iX_i\).

Worked Example: Constructing the Interaction Term

Suppose a hypothetical randomized trial records each participant’s baseline symptom score \(X_i\), from 0 to 100 points, and assigns participants to a new program or usual care. For the interaction model, code the new program as \(T_i=1\) and usual care as \(T_i=0\). The following rows illustrate how the product column is formed.

ParticipantAssignment\(T_i\)\(X_i\) (points)\(T_iX_i\)
ANew program14040
BUsual care0550
CNew program17070

For participant A, the product is \(1\times40=40\); for participant B, it is \(0\times55=0\); and for participant C, it is \(1\times70=70\). The product is not a new measurement: it is a constructed model variable. In the control group it is always zero, while in the treatment group it equals the baseline score. A complete model specification still includes the main-effect columns \(T_i\) and \(X_i\) as well as this product column.

How the Product Allows Treatment Effects to Vary

The structure is easiest to see by writing the model separately for each assignment group. In the control group, \(T_i=0\), so \(T_iX_i=0\). In the treatment group, \(T_i=1\), so \(T_iX_i=X_i\). Substituting those values gives two group-specific conditional mean equations:

$$ \begin{aligned} E(Y_i\mid T_i=0,X_i=x)&=\beta_0+\beta_2x,\\ E(Y_i\mid T_i=1,X_i=x)&=\beta_0+\beta_1+(\beta_2+\beta_3)x. \end{aligned} $$

Thus the control-group baseline slope is \(\beta_2\), while the treatment-group baseline slope is \(\beta_2+\beta_3\). If \(\beta_3=0\), those slopes are equal and the model reduces to common-slope ANCOVA. If \(\beta_3\) is not zero, the fitted baseline slopes differ. This is the model’s flexibility: baseline outcome can be related to follow-up outcome differently across assignment groups.

Subtracting the control conditional mean from the treatment conditional mean at the same baseline value \(x\) shows how the model allows the treatment contrast to vary:

$$ \begin{aligned} \Delta(x) &=E(Y_i\mid T_i=1,X_i=x)-E(Y_i\mid T_i=0,X_i=x)\\ &=\left[\beta_0+\beta_1+(\beta_2+\beta_3)x\right] -\left[\beta_0+\beta_2x\right]\\ &=\beta_1+\beta_3x. \end{aligned} $$

This derivation is the key structural result. Without the product term, the \(x\)-dependent part cancels and the modelled contrast is constant. With the product term, the contrast includes a term that depends on baseline. The change in the modelled contrast for a one-unit increase in baseline is \(\beta_3\). This equation describes the model’s form; interpreting estimated coefficients in detail and calculating conditional treatment effects are separate tasks.

Worked Example: Writing Both Group-Specific Equations

Consider a hypothetical trial of a learning program. Let \(Y_i\) be a follow-up test score in points, \(X_i\) the baseline test score in points, and \(T_i=1\) for assignment to the program or \(T_i=0\) for control. Suppose the specified model is

$$ E(Y_i\mid T_i,X_i)=30+2T_i+0.5X_i-0.02(T_iX_i). $$

For control participants, substitute \(T_i=0\) and \(T_iX_i=0\):

$$ E(Y_i\mid T_i=0,X_i=x)=30+2(0)+0.5x-0.02(0)=30+0.5x. $$

For program participants, substitute \(T_i=1\) and \(T_iX_i=x\):

$$ E(Y_i\mid T_i=1,X_i=x)=30+2(1)+0.5x-0.02(x)=32+0.48x. $$

The model assigns different baseline slopes: \(0.5\) points of follow-up score per baseline point in control and \(0.48\) in the program group. Its conditional contrast has the form \(2-0.02x\), so it is not constrained to be identical at all baseline scores. These equations follow from substitution into the stated model; they do not establish that the model is suitable for every trial.

Recognizing Each Model Term

The terms have distinct jobs, although their coefficient meanings depend on the scales and coding used. The intercept is the model’s constant term. The treatment main-effect term distinguishes assignment groups. The baseline main-effect term represents a baseline association included in both groups. The product term allows that association to differ by assignment. Keeping these pieces distinct helps prevent a frequent error: treating the interaction as if it replaced either main effect.

Model termWhat it contributes to the specification
\(\beta_0\)The constant term in the conditional mean model
\(\beta_1T_i\)A treatment-assignment term in addition to the constant and baseline terms
\(\beta_2X_i\)A baseline-outcome term included in both groups
\(\beta_3(T_iX_i)\)A product term that permits the baseline slope, and therefore the modelled contrast, to vary with baseline
\(\varepsilon_i\)The part of the observed outcome not represented by the conditional mean model

Worked Example: Comparing the Common-Slope and Interaction Specifications

Suppose a hypothetical clinical trial measures a baseline score \(X_i\) in points and a follow-up score \(Y_i\) in points, with \(T_i=1\) for the assigned treatment and \(T_i=0\) for control. Compare the common-slope ANCOVA model with the interaction model:

$$ \begin{aligned} \text{Common-slope model:}\quad E(Y_i\mid T_i,X_i)&=\beta_0+\beta_1T_i+\beta_2X_i,\\ \text{Interaction model:}\quad E(Y_i\mid T_i,X_i)&=\beta_0+\beta_1T_i+\beta_2X_i+\beta_3(T_iX_i). \end{aligned} $$

Take a participant with baseline score \(X_i=50\). Under control, \(T_iX_i=0\times50=0\); under treatment, \(T_iX_i=1\times50=50\). The control conditional mean in either model is \(\beta_0+50\beta_2\). The treatment conditional mean in the common-slope model is \(\beta_0+\beta_1+50\beta_2\); in the interaction model it is \(\beta_0+\beta_1+50\beta_2+50\beta_3\). The additional contribution appears only in the interaction model, and it is formed by multiplying the baseline value by the treatment indicator.

This comparison identifies exactly what the added term changes. It does not change the measured outcomes or the randomized assignment; it changes the conditional-mean structure the regression model is allowed to represent.

Common Mistakes and Practical Checks

Before fitting or reporting this model, check the data coding and the intended question. The interaction is specifically between assigned treatment and a pre-treatment baseline outcome. A product involving a post-treatment measurement is a different specification and should not be substituted for the baseline interaction described here.

  • Omitting a main effect. Including \(T_iX_i\) but omitting \(T_i\) or \(X_i\) is not the standard hierarchical interaction specification. Include both main effects with their product.
  • Using the wrong treatment coding. The equations above assume treatment is coded 1 and control 0. Check the coding before constructing the product; reversing the labels changes the model’s coefficient parameterization.
  • Calling the interaction a new outcome. \(T_iX_i\) is a predictor constructed from two existing variables, not an observed follow-up result.
  • Assuming randomization guarantees a good model form. Random assignment does not ensure that a straight-line relationship between baseline and follow-up is adequate, or that the error assumptions hold. Consider whether the specified conditional mean is plausible for the observed baseline range.
  • Assuming the common-slope model already allows variation in the contrast. It does not: without the product term, the treatment and control equations have the same baseline slope, and their difference is constant with respect to baseline.

For example, the reasoning “the baseline score is included, so treatment effects can already vary with baseline” is incorrect for common-slope ANCOVA. The correction is to distinguish adjustment for baseline from modification of the treatment contrast: a shared baseline term adjusts the fitted outcome for baseline, while \(T_iX_i\) permits the baseline slope to differ by assignment group.

An interaction model is useful when allowing the treatment contrast to depend on baseline is substantively relevant and supported by the data and design. It is not automatically preferable in every analysis. Its specification should be stated transparently, using the assignment coding, outcome definitions, and baseline scale that were actually used.

Key takeaway: The treatment-by-baseline interaction ANCOVA model includes treatment, baseline, and their product. The product term allows the group-specific baseline slopes to differ, so the modelled treatment contrast can vary with baseline outcome.

Check Your Understanding

Use the model \(E(Y_i\mid T_i,X_i)=\beta_0+\beta_1T_i+\beta_2X_i+\beta_3(T_iX_i)\) and the definitions in this tutorial.

  1. If \(T_i=0\) and \(X_i=35\), what is \(T_iX_i\)? If \(T_i=1\) at the same baseline value, what is the product?
  2. Write the conditional mean for a control participant, then for a treatment participant, using a generic baseline value \(x\).
  3. What restriction on the interaction coefficient reduces the model to common-slope ANCOVA?
  4. In words, what does adding the product term allow the model to represent that the common-slope model does not?
  5. Why should the treatment and baseline main effects remain in a model that includes their product?