Tutorials › Model-Informed Drug Development (MIDD) › Separating Exposure Effects From Time-Varying Confounding

Case Studies: Questions, Evidence and Decisions · Tutorial 536 of 596

Separating Exposure Effects From Time-Varying Confounding

Work through a hypothetical longitudinal treatment case to see how time-varying confounding distorts exposure-efficacy estimates and how model-based adjustment can recover a defined causal contrast.

Advanced 12 min read

What You'll Learn

  • Distinguish a crude exposure-outcome association from a causal effect of a specified dosing regimen.
  • Explain how disease progression can both respond to earlier treatment and confound later treatment.
  • State the assumptions needed to identify a longitudinal regimen effect from observational data.
  • Derive and apply the g-formula while averaging over the baseline covariate distribution.
  • Compare g-computation with inverse-probability weighting and recognize positivity problems.
  • Diagnose model misspecification, poor overlap, and residual confounding in an adjusted analysis.

Why a Longitudinal Exposure Association Can Mislead

In an observational treatment course, dose is often changed in response to a patient's evolving condition. A patient whose disease worsens may receive a higher dose; that worsening may also predict a worse outcome. Consequently, patients with higher observed exposure can have poorer outcomes even when the drug is beneficial. The reverse distortion is also possible: patients who improve may remain on treatment longer, making continued exposure appear especially effective.

The difficulty is not merely that a prognostic covariate was omitted. Disease status at an intermediate visit may be affected by earlier treatment and then influence both later treatment and outcome. Adjusting for it in a conventional regression can remove part of the earlier treatment effect, while failing to adjust for it can confound the later treatment effect. The analysis must represent the treatment and disease history in the correct time order.

Definition: A time-varying confounder is a variable measured over time that predicts subsequent treatment and the outcome. In the setting of treatment-confounder feedback, it is also affected by prior treatment. A regimen effect compares outcomes that would occur under specified treatment choices at each decision time, rather than comparing groups defined by their observed exposure histories.

Here, \(A_0\) denotes treatment or exposure at the first decision, \(L_0\) measured baseline disease status, \(L_1\) disease status after the first decision, \(A_1\) treatment at the second decision, and \(Y\) a later continuous efficacy outcome, with larger values representing greater benefit. This tutorial uses two decision times to make the reasoning explicit; the same logic extends to longer histories.

Define the Causal Question and Its Assumptions

For example, one may ask for the mean outcome if every eligible patient followed the regimen \(A_0=1,A_1=1\), compared with the mean if every patient followed \(A_0=0,A_1=0\). These are hypothetical interventions on treatment choices, not claims that patients in the observed data actually followed those regimens. An exposure-based intervention must also be scientifically meaningful: a concentration target may not be well-defined if different dosing strategies produce different effects beyond that concentration.

Identification from observational data requires assumptions. Consistency means that a patient's observed outcome equals the potential outcome under the treatment history the patient actually received, and that treatment versions relevant to the question are sufficiently well specified. Sequential exchangeability means that, conditional on measured history, treatment assignment at each decision is independent of the relevant future potential outcomes. In this setting, baseline history \(L_0\) must suffice to control confounding of \(A_0\), while history including \(A_0,L_0,L_1\) must suffice to control confounding of \(A_1\). Positivity means that each treatment choice in the regimes being compared has positive probability for every history represented in the target population. The analysis also assumes no interference between patients and adequate measurement and modeling of the relevant variables.

These assumptions cannot be established merely by fitting a model. In particular, sequential exchangeability is not guaranteed by adjustment for the variables available in a data set: important unmeasured disease severity, adherence, or clinician judgment can leave residual confounding. The causal interpretation is conditional on the stated assumptions.

Deriving the Longitudinal g-Formula

Let \(Y^{a_0,a_1}\) denote the potential outcome under the fixed regimen \(A_0=a_0,A_1=a_1\), and let \(L_1^{a_0}\) denote the intermediate disease state that would occur under first treatment \(a_0\). For discrete \(L_0\) and \(L_1\), the mean outcome under the regimen is identified by:

$$ E[Y^{a_0,a_1}] = \sum_{l_0}\sum_{l_1} E[Y\mid A_0=a_0,L_0=l_0,L_1=l_1,A_1=a_1]\, P(L_1=l_1\mid A_0=a_0,L_0=l_0)\, P(L_0=l_0) $$

The baseline distribution \(P(L_0=l_0)\) is essential: it describes the target population before treatment, rather than the subset of patients who happened to receive \(a_0\). Omitting \(L_0\) from the conditional models or averaging over the treated group's baseline distribution can give the wrong regime mean.

The formula follows by averaging the outcome under the regimen over the disease state that would arise under its first treatment, and then over baseline status. Specifically, iterated expectation gives \(E[Y^{a_0,a_1}]=\sum_{l_0,l_1}E[Y^{a_0,a_1}\mid L_0=l_0,L_1^{a_0}=l_1]P(L_1^{a_0}=l_1\mid L_0=l_0)P(L_0=l_0)\). Consistency and sequential exchangeability identify the first conditional mean with the observed outcome mean among patients with the specified treatment and history, and identify the intermediate-state distribution with the observed conditional distribution under \(A_0=a_0\). This yields the displayed formula. For continuous covariates, the corresponding sums are integrals.

In practice, g-computation estimates the conditional distribution of \(L_1\) given \(A_0,L_0\), and the conditional mean of \(Y\) given \(A_0,L_0,L_1,A_1\). It then predicts outcomes under each regime for the baseline population, averages those predictions, and contrasts the regime means. This approach retains the pathway through which early treatment changes later disease status; it does not simply hold \(L_1\) fixed when comparing early treatment.

Worked Example: A Crude Association Reverses the Treatment Effect

Suppose, hypothetically, that patients with severe disease have an expected efficacy score of 30 without a high-exposure treatment and patients with mild disease have an expected score of 70. For either disease group, high exposure increases the expected score by 8 points. At the treatment decision, 80% of the high-exposure group has severe disease, compared with 20% of the lower-exposure group.

The observed mean for the high-exposure group is \(0.80(38)+0.20(78)=30.4+15.6=46\) points. The observed mean for the lower-exposure group is \(0.20(30)+0.80(70)=6+56=62\) points. The crude difference is \(46-62=-16\) points, which misleadingly associates high exposure with a worse outcome.

Within either disease group, however, the hypothetical treatment difference is \(+8\) points: \(38-30=8\) for severe disease and \(78-70=8\) for mild disease. The crude comparison is distorted because the exposure groups have different disease-status distributions. A causal analysis must address the measured disease history that influenced treatment; the numerical example does not establish that all confounding has been measured.

Worked Example: Standardizing Over Baseline Disease and Progression

Consider a hypothetical two-decision study with \(P(L_0=0)=P(L_0=1)=0.5\), where \(L_0=1\) indicates severe baseline disease. The intermediate progression probabilities are \(P(L_1=1\mid A_0=1,L_0=0)=0.10\), \(P(L_1=1\mid A_0=1,L_0=1)=0.50\), \(P(L_1=1\mid A_0=0,L_0=0)=0.20\), and \(P(L_1=1\mid A_0=0,L_0=1)=0.70\). Suppose the correctly specified conditional outcome mean is \(10+2A_0+3A_1-4L_0-5L_1\) points.

For regimen \((A_0,A_1)=(1,1)\), first consider \(L_0=0\). The predicted mean is 15 points if \(L_1=0\) and 10 points if \(L_1=1\). Averaging with the progression probability under \(A_0=1,L_0=0\) gives \(0.90(15)+0.10(10)=14.5\) points. For \(L_0=1\), the corresponding means are 11 and 6 points, so the average is \(0.50(11)+0.50(6)=8.5\) points. Standardizing over the baseline population gives \(0.50(14.5)+0.50(8.5)=11.5\) points.

For regimen \((0,0)\), when \(L_0=0\), the means for \(L_1=0\) and \(L_1=1\) are 10 and 5 points. Thus the average is \(0.80(10)+0.20(5)=9\) points. When \(L_0=1\), those means are 6 and 1 points, giving \(0.30(6)+0.70(1)=2.5\) points. The standardized mean is \(0.50(9)+0.50(2.5)=5.75\) points. The estimated regimen contrast under this hypothetical model is \(11.5-5.75=5.75\) points in favor of \((1,1)\).

This calculation averages over both baseline disease states and the progression distribution under each regimen. Averaging over the baseline distribution among observed patients with \(A_0=1\) would not implement the same target-population comparison if treatment assignment depends on \(L_0\). The contrast is a model-based causal estimate only if the identification assumptions and the conditional models are adequate.

Weighting as an Alternative Adjustment

Inverse-probability weighting offers a different way to address measured time-varying confounding. Each observed treatment history is weighted by the inverse of its probability conditional on the measured history. Histories that were unlikely under the observed treatment process receive more weight, creating a weighted population in which measured history is less associated with treatment. For two decision times, an unstabilized treatment weight for an individual's observed history is:

$$ W_i= \frac{1}{ P(A_{0i}\mid L_{0i})\, P(A_{1i}\mid A_{0i},L_{0i},L_{1i}) } $$

Under the assumptions already stated and correctly estimated treatment probabilities, a weighted comparison can estimate regimen effects. Unlike ordinary regression that conditions on \(L_1\) as a fixed covariate, the weighting approach can account for its role as a confounder of \(A_1\) while avoiding direct adjustment that blocks the pathway from \(A_0\) through \(L_1\). G-computation and weighting rely on different models—the former for outcome and intermediate-state distributions, the latter for treatment probabilities—and can be used as complementary analyses. Neither method repairs unmeasured confounding or poor data.

Worked Example: A History Weight and a Positivity Warning

Suppose, hypothetically, that \(P(A_0=1\mid L_0=1)=0.60\), and among patients with \(A_0=1,L_0=1,L_1=1\), the probability of receiving \(A_1=1\) is 0.80. A patient with this observed history and treatments \(A_0=A_1=1\) has unstabilized weight:

$$ W=\frac{1}{0.60\times0.80} =\frac{1}{0.48} =2.083 $$

The patient's contribution is weighted about 2.083 times as heavily as an unweighted contribution. If a different history had treatment probabilities 0.10 and 0.20, its joint probability would be \(0.10\times0.20=0.02\), and its corresponding weight would be \(1/0.02=50\). Such a large weight signals that the observed data provide little support for that treatment history. Weighting cannot create reliable information where treatment choices are nearly absent.

Diagnostics, Limitations, and Common Pitfalls

Before interpreting an adjusted estimate, inspect whether the data support the comparison. Check treatment probabilities across measured histories, the number of patients following each relevant history, and whether model predictions for \(L_1\) and \(Y\) are plausible. For weighting analyses, inspect the distribution of weights, extreme values, and the effective sample size; a small effective sample size indicates that a few observations dominate. Weight truncation may reduce variance but changes the analysis and can introduce bias, so report it as a sensitivity analysis rather than a cure for positivity violations.

For g-computation, assess model fit and sensitivity to reasonable alternative specifications, including nonlinear relationships and interactions when clinically justified. Compare results from plausible outcome and intermediate-state models. A model can fit the observed data reasonably yet extrapolate poorly to a treatment history scarcely represented in a subgroup. If estimates change substantially under modest modeling choices, the data may not support a stable causal conclusion.

A common mistake is to add \(L_1\) to a single outcome regression and interpret the coefficient of \(A_0\) as the total effect of early treatment. This conditions on disease status that may itself have been changed by \(A_0\), thereby blocking part of the effect pathway; it may also create additional bias under some causal structures. The correction is to define the regimen contrast first, then use a longitudinal method such as g-computation or inverse-probability weighting under explicit assumptions. Another mistake is to treat a measured exposure concentration as if it were randomized: disease progression, adherence, clearance, and dose changes can all shape observed exposure. Adjustment can address only relevant confounders that were measured adequately and modeled appropriately.

The methods also have limitations. Treatment probabilities and outcome models are estimated from finite data; uncertainty should reflect that estimation, for example through appropriate resampling. Exposure may be measured with error, and dose or concentration may not uniquely define a feasible intervention. Informative dropout requires additional modeling or weighting assumptions. These analyses estimate effects for a specified target population and treatment contrast, not a universal drug effect.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. Why can a disease measure after the first treatment be both a confounder of later treatment and a mediator of the first treatment's effect?
  2. In the g-formula, why is the baseline distribution \(P(L_0)\) used rather than the distribution among patients observed with \(A_0=a_0\)?
  3. In a hypothetical history, \(P(A_0=1\mid L_0)=0.50\) and \(P(A_1=1\mid A_0,L_0,L_1)=0.25\). What is the unstabilized weight for an individual receiving both treatments?
  4. What does an extremely large inverse-probability weight suggest, and why does truncating it not solve the underlying issue?

Solutions. (1) Earlier treatment can change disease status \(L_1\), making it a mediator for \(A_0\); \(L_1\) can also influence the later treatment \(A_1\) and predict \(Y\), making it a confounder of the later treatment effect. (2) The target is the original baseline population. The observed \(A_0=a_0\) group may have a different baseline mix because treatment assignment depends on \(L_0\); using its distribution can change the target population and yield a biased regime mean. (3) \(W=1/(0.50\times0.25)=1/0.125=8\). (4) It suggests that the observed treatment history was unlikely given measured covariates, often indicating weak positivity and potentially unstable estimates. Truncation limits the influence of extreme weights but may add bias and cannot supply the missing treatment-history information.