Tutorials › Marginal Structural Models › Treatment-By-Confounder Interactions In Longitudinal Regression

Time-Varying Treatments and Confounder Feedback · Tutorial 13 of 501

Treatment-By-Confounder Interactions In Longitudinal Regression

You will fit and interpret an interaction model that allows the later-treatment contrast to vary across levels of an intermediate confounder.

Intermediate 10 min read

What You'll Learn

  • Specify a longitudinal outcome regression with a later treatment-by-intermediate-confounder interaction.
  • Calculate the fitted treatment contrast at a chosen confounder level.
  • Interpret the interaction coefficient as a change in the treatment contrast per unit of the confounder.
  • Re-express the model after centering the confounder without changing its fitted values.
  • Distinguish effect modification in the model from confounding control and from a causal conclusion.
  • Check support and model fit before interpreting estimated contrasts.

Why Include a Treatment-by-Confounder Interaction?

In a longitudinal study, treatment at a later visit may be assigned partly in response to a covariate measured between treatment decisions. That intermediate covariate can be associated with both the later treatment and the outcome. A regression that includes the covariate but omits its interaction with later treatment makes an additional assumption: on the outcome scale being modeled, the treatment contrast is the same at every covariate level.

An interaction relaxes that restriction. It allows the model to represent different fitted treatment contrasts for people with different values of the intermediate covariate. This is a statement about how the conditional outcome model varies; by itself it does not establish that the fitted contrasts are causal effects.

Definition: Let \(A_1\) denote treatment at the first visit, \(L_1\) an intermediate covariate measured after \(A_1\) and before the next treatment decision, \(A_2\) treatment at the second visit, and \(Y\) the outcome. For binary \(A_1\) and \(A_2\) and a numeric \(L_1\), a linear outcome regression with an \(A_2\)-by-\(L_1\) interaction is $$ E[Y\mid A_1,L_1,A_2] =\beta_0+\beta_1 A_1+\beta_2 L_1+\beta_3 A_2+\beta_4(A_2L_1). $$ Here \(\beta_4\) permits the fitted \(A_2\) contrast to change with \(L_1\). The model as written includes no other interactions.

The model is a conditional-mean specification. It assumes that, for the covariate range of interest, the conditional mean is linear in \(A_1\) and \(L_1\), and that its dependence on \(A_2\) is linear with a slope that changes linearly in \(L_1\). The coefficient \(\beta_1\) is the fitted difference associated with \(A_1\) at fixed \(L_1,A_2\), under the model’s restriction that this difference does not vary with either. Those restrictions should be explicit: including one interaction does not make every relationship flexible.

Deriving the Treatment Contrast

At fixed values \(A_1=a\) and \(L_1=l\), compare the model-predicted means for \(A_2=1\) and \(A_2=0\). The terms involving \(A_1\) and \(L_1\) are the same in both predictions and cancel.

Result: Under the stated regression model, the fitted conditional mean contrast for \(A_2=1\) versus \(A_2=0\), at \(A_1=a,L_1=l\), is \(\beta_3+\beta_4l\). Thus \(\beta_3\) is the fitted contrast at \(L_1=0\), while \(\beta_4\) is the change in that contrast for a one-unit increase in \(L_1\).

To verify this, substitute each treatment value into the conditional mean:

$$ \begin{aligned} m(a,l,1)&=\beta_0+\beta_1a+\beta_2l+\beta_3+\beta_4l,\\ m(a,l,0)&=\beta_0+\beta_1a+\beta_2l,\\ m(a,l,1)-m(a,l,0)&=\beta_3+\beta_4l. \end{aligned} $$

This derivation also shows why \(\beta_3\) alone is generally not the treatment contrast for every person: it is the contrast specifically at \(l=0\). If zero is outside the meaningful range of \(L_1\), that coefficient may be a poor summary to report on its own.

Worked Example: Contrasts at Different Covariate Levels

Suppose a fitted model has \(\hat\beta_0=10\), \(\hat\beta_1=2\), \(\hat\beta_2=1.5\), \(\hat\beta_3=-3\), and \(\hat\beta_4=-2\). Interpret the \(A_2\) contrast at \(L_1=0,1,\) and \(2\), holding \(A_1=1\).

The fitted contrast is \(\hat\beta_3+\hat\beta_4l=-3-2l\). Therefore, at \(L_1=0\), the contrast is \(-3-2(0)=-3\). At \(L_1=1\), it is \(-3-2(1)=-5\). At \(L_1=2\), it is \(-3-2(2)=-7\). On the outcome scale, the model predicts progressively lower outcomes under \(A_2=1\) than under \(A_2=0\) as \(L_1\) increases.

The predictions can be checked directly. At \(A_1=1,L_1=1\), the predicted mean for \(A_2=0\) is \(10+2(1)+1.5(1)=13.5\); for \(A_2=1\), it is \(10+2(1)+1.5(1)-3-2(1)=8.5\). Their difference is \(8.5-13.5=-5\), as given by the contrast formula. These are model-based conditional means, not automatically causal effects.

What the Interaction Coefficient Means

The coefficient \(\beta_4\) is a difference in treatment contrasts across covariate levels. For two values \(l_1\) and \(l_0\), the model-implied contrast at \(l_1\) minus the contrast at \(l_0\) is

$$ (\beta_3+\beta_4l_1)-(\beta_3+\beta_4l_0)=\beta_4(l_1-l_0). $$

In particular, a one-unit increase in \(L_1\) changes the fitted \(A_2\) contrast by \(\beta_4\) outcome units. This is effect modification on the additive outcome scale used by the linear model. A different outcome scale or link function generally gives a different interaction interpretation.

Worked Example: A Binary Intermediate Confounder

Suppose \(L_1\) is binary, with \(L_1=0\) indicating lower severity and \(L_1=1\) indicating higher severity. A fitted regression gives \(\hat\beta_3=1\) and \(\hat\beta_4=-4\), along with \(\hat\beta_0=20,\hat\beta_1=2,\hat\beta_2=3\). Calculate the fitted \(A_2\) contrasts and fitted means when \(A_1=0\).

For \(L_1=0\), the contrast is \(1+(-4)(0)=1\). The fitted mean under \(A_2=0\) is \(20+3(0)=20\), and under \(A_2=1\) it is \(20+1=21\), a difference of \(21-20=1\).

For \(L_1=1\), the contrast is \(1+(-4)(1)=-3\). The fitted mean under \(A_2=0\) is \(20+3(1)=23\), and under \(A_2=1\) it is \(20+3+1-4=20\), a difference of \(20-23=-3\). The difference between the two treatment contrasts is \(-3-1=-4=\hat\beta_4\). The interaction therefore captures the change in contrast between the two covariate groups.

Centering Changes the Reference Level, Not the Model

When \(L_1=0\) is not a useful reference value, center the covariate at a meaningful value \(c\). Define \(L_{1c}=L_1-c\). Rewriting the same model gives

$$ \begin{aligned} E[Y\mid A_1,L_1,A_2] &=(\beta_0+c\beta_2)+\beta_1A_1+\beta_2L_{1c}\\ &\quad+(\beta_3+c\beta_4)A_2+\beta_4(A_2L_{1c}). \end{aligned} $$

The fitted values and the interaction coefficient are unchanged. The coefficient of \(A_2\), however, now represents the fitted treatment contrast at \(L_1=c\), because \(L_{1c}=0\) there.

Worked Example: Centering at a Meaningful Covariate Value

Use the estimates from the first example and center \(L_1\) at \(c=2\), so \(L_{1c}=L_1-2\). The new intercept is \(\hat\beta_0+c\hat\beta_2=10+2(1.5)=13\). The new \(A_2\) coefficient is \(\hat\beta_3+c\hat\beta_4=-3+2(-2)=-7\). The coefficient of \(L_{1c}\) remains \(1.5\), and the interaction coefficient remains \(-2\).

The centered model therefore gives the \(A_2\) contrast as \(-7-2L_{1c}\). At the original value \(L_1=2\), \(L_{1c}=0\), so the contrast is \(-7\), matching \(-3-2(2)=-7\). At \(L_1=1\), \(L_{1c}=-1\), so it is \(-7-2(-1)=-5\), again matching the uncentered model. Centering changes coefficient reference points, not the underlying predictions.

Assumptions, Checks, and Alternatives

The interaction model is useful only where its form and the data support interpretation. For a causal interpretation of a later-treatment contrast within a treatment and covariate history, additional assumptions are needed. These include consistency (the observed outcome under the received treatment history equals the corresponding potential outcome), sequential exchangeability of \(A_2\) and relevant potential outcomes conditional on the measured pre-\(A_2\) history, and positivity (each treatment level being compared has positive probability at the histories of interest). A correctly specified outcome model and no interference are also needed for the corresponding model-based causal conclusion. Without these conditions, the regression still describes fitted conditional means, but should not be called a causal effect.

The presence of an intermediate covariate does not itself demand an interaction. Including \(L_1\) as a main effect allows the fitted outcome level to vary with \(L_1\); including \(A_2L_1\) additionally allows the fitted treatment contrast to vary. They answer different modeling questions. Omitting the interaction imposes \(\beta_4=0\), and hence a constant additive contrast. Stratifying by \(L_1\) can make group-specific contrasts transparent, but may use data less efficiently and become unstable in sparse strata. A more flexible function of \(L_1\) may be appropriate when a linear change in the contrast is implausible, but requires enough data and careful specification.

Useful checks include examining the observed combinations of \(A_2\) and \(L_1\), especially near the extremes of \(L_1\); a model cannot reliably estimate contrasts in histories with little or no treatment overlap. Inspect residual patterns and compare the linear interaction with plausible alternatives, such as a categorical \(L_1\) interaction when \(L_1\) has few levels. Report contrasts at meaningful covariate values with uncertainty, rather than reporting only \(\hat\beta_3\). A small estimated interaction does not prove constant effects: its uncertainty and the precision of the contrasts matter.

A common mistake is to interpret \(\hat\beta_3\) as the universal effect of \(A_2\), even when \(\hat\beta_4\ne0\). The correction is to calculate \(\hat\beta_3+\hat\beta_4l\) at the covariate levels of interest. Another mistake is to infer causality merely because \(L_1\) was adjusted for and an interaction was included. The interaction represents modeled heterogeneity; it does not supply exchangeability, positivity, or correct specification.

Finally, because \(L_1\) follows \(A_1\), a conditional contrast at fixed \(L_1\) is not automatically a comparison of complete treatment histories from baseline. The coefficient interpretation here is deliberately conditional on the observed history before \(A_2\). Broader regime comparisons require additional reasoning beyond reading a single interaction coefficient.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. In the model \(E[Y\mid A_1,L_1,A_2]=\beta_0+\beta_1A_1+\beta_2L_1+\beta_3A_2+\beta_4A_2L_1\), what is the fitted contrast for \(A_2=1\) versus \(A_2=0\) at \(L_1=l\)?
  2. If \(\hat\beta_3=2\) and \(\hat\beta_4=0.5\), what are the fitted contrasts at \(L_1=0\) and \(L_1=4\)?
  3. After centering \(L_1\) at \(c=3\), what is the new \(A_2\) coefficient in terms of \(\beta_3,\beta_4\), and what does it represent?
  4. Does including \(A_2L_1\) by itself establish that the fitted treatment contrasts are causal? State two further requirements.

Solutions. 1. Subtracting the two fitted means gives \(\beta_3+\beta_4l\). 2. At zero, the contrast is \(2+0.5(0)=2\); at four, it is \(2+0.5(4)=4\). 3. The new coefficient is \(\beta_3+3\beta_4\), the fitted contrast at the original covariate value \(L_1=3\). 4. No. For example, a causal interpretation requires sequential exchangeability and positivity, as well as consistency and an adequately specified model.

Clinical Biostats