Tutorials › Marginal Structural Models › Avoiding Future Covariates in Treatment Models

Inverse Probability of Treatment Weights · Tutorial 123 of 501

Avoiding Future Covariates in Treatment Models

Use the information available immediately before each treatment decision to identify valid predictors and recognize the bias that can result from using later measurements.

Advanced 12 min read

What You'll Learn

  • Define the covariate history available immediately before a treatment decision.
  • Distinguish pre-decision measurements from measurements recorded later in the same visit.
  • Explain why a future covariate is not a valid predictor in a treatment probability model.
  • Work through a numerical example showing how future-covariate adjustment can distort weighted balance.
  • Check treatment-model data for temporal leakage and ambiguous measurement timing.
  • Distinguish a genuinely available lagged measurement from a future value carried backward.

Why the Timing of a Predictor Matters

A treatment probability model should describe the chance of receiving treatment using information available when that treatment decision is made. In longitudinal data, this sounds straightforward until measurements and decisions are recorded by visit or date rather than by their actual order. A value labeled “week 4” might have been collected before the week 4 treatment decision, after it, or at an unclear point during the visit. Those distinctions matter: a measurement recorded after treatment cannot be used to represent the information available to assign that treatment.

The issue is not merely whether a variable predicts treatment well. A future measurement may predict an earlier treatment because treatment affects that measurement, because both reflect underlying illness, or because the data contain information from the future. Conditioning on it can change the treatment probabilities used for weighting and undermine the intended comparison.

Define the History at Each Decision

Let \(A_t\) denote treatment at decision time \(t\). Let \(L_t\) denote covariates measured immediately before that decision, and let \(L_{t+1}\) denote measurements taken after \(A_t\) and before the next decision. The observed history immediately before \(A_t\) is

$$ H_t=(L_0,A_0,L_1,A_1,\ldots,A_{t-1},L_t). $$

The treatment probability at time \(t\) is the conditional probability of the treatment actually assigned, given that pre-decision history. For binary treatment, for example, the model describes \(P(A_t=1\mid H_t)\) and \(P(A_t=0\mid H_t)\). A measurement belongs in \(H_t\) only if it was available before \(A_t\) was decided.

Definition: A future covariate for decision \(t\) is a measurement made after \(A_t\) has been assigned. It is not part of the information history \(H_t\), even if it is stored in the same visit record or has a time label that looks simultaneous. A covariate measured before \(A_t\) may be used; one measured after \(A_t\) may not.

This rule is relative to the particular decision. \(L_2\) is future information for a decision at \(t=1\), but it can be a valid pre-decision covariate for a later decision at \(t=2\), if it was measured before \(A_2\). Likewise, a value collected during a visit is not automatically valid or invalid: the actual order of measurement and treatment assignment determines its status.

Why Future Measurements Do Not Belong in the Treatment Model

The inverse probability of treatment weight uses probabilities for the treatment assignments along a person's observed history. For a fixed treatment sequence \(\bar a=(a_0,\ldots,a_K)\), its unstabilized regime weight has the form

$$ W_{\bar a} = \frac{\mathbb{1}(A_0=a_0,\ldots,A_K=a_K)} {\prod_{t=0}^{K}P(A_t=a_t\mid H_t)}. $$

The denominator represents sequential assignment probabilities given the information available at each decision. Replacing \(H_t\) by a history that includes \(L_{t+1}\) changes the conditional probability being modeled: it becomes a probability of an earlier assignment given later information. That is not the assignment mechanism at time \(t\). In particular, if treatment affects \(L_{t+1}\), conditioning on that measurement can condition on a consequence of the treatment itself.

The following identification result states the role of the correctly timed history. For clarity, take a finite number of decision times and discrete covariates and outcomes; the same argument applies to continuous variables using conditional densities. Assume consistency, sequential exchangeability given each \(H_t\), and positivity: every treatment required by the regime has positive probability at histories that can occur under that regime.

Theorem: Under consistency, sequential exchangeability, and positivity, the mean outcome under a fixed regime \(\bar a\) equals the expectation of the observed outcome weighted by the inverse probabilities of following that regime:
$$ E[Y^{\bar a}] = E\left[ \frac{\mathbb{1}(A_0=a_0,\ldots,A_K=a_K)Y} {\prod_{t=0}^{K}P(A_t=a_t\mid H_t)} \right]. $$

Here, consistency means that a person who follows \(\bar a\) has observed outcome \(Y=Y^{\bar a}\). Sequential exchangeability means that, at each decision, treatment assignment is independent of the relevant future potential outcomes conditional on the observed pre-decision history among people following the regime up to that time. Positivity requires \(P(A_t=a_t\mid H_t)>0\) at histories with positive probability under the regime.

Derivation. Write the observed-data distribution as a product of successive treatment probabilities and conditional distributions of covariates and the outcome. Restricting to the regime \(\bar a\) selects the factors for \(A_t=a_t\). Multiplying by the indicator of following \(\bar a\) and dividing by \(\prod_t P(A_t=a_t\mid H_t)\) cancels those treatment-probability factors. The remaining factors are the covariate and outcome distributions under the intervention that sets each \(A_t=a_t\). Consistency and sequential exchangeability identify those factors with the corresponding distributions of \(L_{t+1}^{\bar a}\) and \(Y^{\bar a}\); summing over the covariate histories therefore gives \(E[Y^{\bar a}]\). Positivity ensures the divisions are defined. Thus the probabilities that cancel are precisely the probabilities conditional on the pre-decision histories \(H_t\), not probabilities conditional on future measurements. \(\square\)

Worked Examples: Classifying Measurements by Decision Time

Worked Example: A Biomarker Measured After Treatment

At month 0, clinicians record disease severity \(L_0\), then assign treatment \(A_0\). At month 1, they measure a biomarker \(L_1\). At month 2, they record severity \(L_2\), then assign \(A_2\). Which measurements can enter each treatment model?

For \(A_0\), the available history includes \(L_0\). Both \(L_1\) and \(L_2\) occur later, so neither belongs in the model for \(P(A_0\mid H_0)\). This remains true if \(L_1\) is strongly associated with \(A_0\): its association may partly arise because \(A_0\) changed the biomarker.

For \(A_2\), if \(L_1\) was measured before that decision, the history includes \(L_0,A_0,L_1,A_1,L_2\) (and any other earlier observed covariates). Thus \(L_1\) can be used for \(A_2\), as can \(L_2\), because it was measured before \(A_2\). The same value can be future information for one decision and valid history for another.

Worked Example: A Later Visit Value Cannot Be Carried Backward

A registry contains a blood pressure measured on day 14. A treatment decision was made on day 10, and another decision is made on day 20. The day 14 value is available in the final data file for both decisions. Determine its status.

For the day 10 decision, the measurement is future: day 14 is later than day 10. Including it in the day 10 treatment model uses information that did not exist at that decision. For the day 20 decision, the same measurement was already recorded six days earlier, so it can be part of the history, assuming it was observed before the day 20 assignment.

Suppose the day 14 value is missing for some patients, and an analyst fills it backward into day 10 records. This does not make the value pre-decision information. Carrying a future measurement backward changes its placement in the data, not its time of observation. The appropriate day 10 predictors are measurements actually available by day 10.

Worked Example: How Future-Covariate Adjustment Distorts Weights

Worked Example: A Post-Treatment Marker and Baseline Balance

Let \(U\) be a binary baseline confounder with \(P(U=1)=0.5\). Treatment \(A\) is assigned with \(P(A=1\mid U=1)=0.8\) and \(P(A=1\mid U=0)=0.2\). After treatment, a binary marker \(L\) is measured. Suppose \(P(L=1\mid A=1)=0.8\) and \(P(L=1\mid A=0)=0.2\), independently of \(U\) given \(A\). The marker is therefore a post-treatment measurement. Compare the treated-group balance obtained from weights using \(U\) with weights using both \(U\) and future \(L\).

First use the correct treatment probability \(P(A=1\mid U)\). The joint probabilities of being treated and having each value of \(U\) are

$$ P(U=1,A=1)=0.5(0.8)=0.4,\qquad P(U=0,A=1)=0.5(0.2)=0.1. $$

The treated observations receive weights \(1/0.8\) when \(U=1\) and \(1/0.2\) when \(U=0\). Their weighted masses are \(0.4/0.8=0.5\) and \(0.1/0.2=0.5\), respectively. After normalization, half the weighted treated group has \(U=1\), matching the population proportion \(P(U=1)=0.5\).

Now suppose the model incorrectly uses \(P(A=1\mid U,L)\). Bayes' rule gives the needed probabilities. For \(U=1,L=1\), the contributions to the denominator are \(0.8(0.8)=0.64\) from \(A=1\) and \(0.2(0.2)=0.04\) from \(A=0\), so \(P(A=1\mid U=1,L=1)=0.64/(0.64+0.04)=16/17\). For \(U=1,L=0\), the corresponding values are \(0.8(0.2)=0.16\) and \(0.2(0.8)=0.16\), giving probability \(1/2\)? More carefully, the treated contribution is \(0.8(0.2)=0.16\), and the untreated contribution is \(0.2(0.8)=0.16\), so the probability is \(1/2\). The joint probability \(P(U=1,L=0,A=1)\) is \(0.5(0.8)(0.2)=0.08\); thus its treated weight contribution is \(0.08/(1/2)=0.16\).

For \(U=0,L=1\), the contributions are \(0.2(0.8)=0.16\) and \(0.8(0.2)=0.16\), so the probability is \(1/2\). The joint treated mass is \(0.5(0.2)(0.8)=0.08\), giving weighted mass \(0.08/(1/2)=0.16\). For \(U=0,L=0\), the contributions are \(0.2(0.2)=0.04\) and \(0.8(0.8)=0.64\), so the probability is \(1/17\). Its joint treated mass is \(0.5(0.2)(0.2)=0.02\), giving weighted mass \(0.02/(1/17)=0.34\).

The resulting treated weighted masses are \(0.16+0.16=0.32\) for \(U=1\) and \(0.16+0.34=0.50\) for \(U=0\). The weighted proportion with \(U=1\) is \(0.32/(0.32+0.50)=16/41\), about \(0.390\), not \(0.5\). Thus the future marker has changed the weighted distribution of the baseline confounder rather than balancing it to the population distribution.

The calculation is not a general prediction about every future-covariate model; the distortion depends on the joint distribution. It demonstrates that a post-treatment predictor can produce treatment probabilities with the wrong conditioning set, even when the model predicts treatment well.

Practical Checks and Common Failure Modes

Before fitting a treatment model, construct a decision-specific timeline. Record when each treatment was assigned, when each candidate covariate was measured, and which measurements were available at each decision. A visit label alone may not resolve the order. If the order is ambiguous, check the protocol, source records, or data-generation process rather than assuming the covariate preceded treatment.

1
List the decisions.
Identify each treatment assignment time and the treatment actually modeled at that time.
2
Establish measurement order.
For every candidate predictor, determine whether it was observed before or after that assignment.
3
Build the history.
Include baseline values and observed covariates available before the decision, together with prior treatments.
4
Audit the fitted data.
Check data joins, visit windows, imputation, and feature creation for values that have been moved backward in time.

A common mistake is to include every measurement that improves prediction of treatment. The reasoning is that a more predictive model must give better weights. The correction is that prediction quality does not establish that the model conditions on the right information. A future measurement can be highly predictive precisely because it was affected by treatment. The relevant model is the one for assignment conditional on the pre-decision history, subject to the causal assumptions needed for weighting.

Cross-fitting, flexible machine-learning algorithms, calibration, and smoothing do not fix temporal leakage: they can estimate an incorrectly defined conditional probability very accurately. Conversely, a value recorded at the same visit may be appropriate if it was definitely measured before assignment. Timing, not the variable name or visit number, is decisive. When actual ordering is unavailable, conclusions may depend on unverifiable assumptions about that ordering.

This timing rule complements, rather than replaces, the standard assumptions behind inverse probability weighting. It does not guarantee no unmeasured confounding, positivity, correct measurement, or a well-defined treatment strategy. It identifies which observed history is eligible to condition the treatment model; the causal assumptions still require separate justification.

Key takeaway: For each treatment decision, use only measurements available immediately beforehand. A later measurement does not become valid for an earlier treatment model because it is predictive, recorded in the same visit, or carried backward during data processing.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. At decision \(A_1\), \(L_1\) was measured before treatment and \(L_2\) afterward. Which can enter \(P(A_1\mid H_1)\)?
  2. A value measured after \(A_0\) is an excellent predictor of \(A_0\). Does that make it an appropriate predictor in the treatment model? Why?
  3. A covariate is measured after \(A_0\) but before \(A_1\). State its status for each decision.
  4. Why does cross-fitting not solve the problem of including a future covariate?

Solutions. (1) \(L_1\) can enter because it was observed before \(A_1\); \(L_2\) cannot. (2) No. Predictive strength does not change its timing: information observed after \(A_0\) was unavailable for that assignment. (3) It is future information for \(A_0\), but may enter the model for \(A_1\) if observed before that decision. (4) Cross-fitting changes how predictions are estimated or evaluated, not the conditioning set; it can still estimate a treatment probability conditional on information from the future.

Clinical Biostats