Tutorials › Marginal Structural Models › Continuous Treatment Levels and Parametric G-Formula

The Parametric g-Formula · Tutorial 314 of 501

Continuous Treatment Levels and Parametric G-Formula

See how to estimate and compare population outcomes under fixed continuous treatment levels by simulating covariate histories under each level.

Advanced 12 min read

What You'll Learn

  • Define a fixed continuous treatment intervention as a specified sequence of treatment values.
  • Write the longitudinal g-formula for a fixed sequence and identify the assumptions needed for it.
  • Replace treatment values in conditional models and average predicted outcomes over simulated histories.
  • Distinguish a population intervention contrast from a conditional outcome-model contrast.
  • Recognize why factual post-treatment covariates cannot simply be reused under a different treatment level.

From a treatment level to a population outcome

When treatment is continuous, an intervention can set treatment to a specified value, such as a daily dose of 10 units, rather than assign a category such as “treated.” The target is still a population outcome: what would the average outcome be if everyone in the target population followed that specified treatment level or sequence?

The parametric g-formula answers this by combining models for covariate evolution and the outcome. For each intervention, it inserts the intervention’s treatment values into those models, simulates the resulting covariate histories, and averages the predicted outcomes. The treatment assignment model is not part of this calculation. The key is to simulate the covariates that would arise under the intervention, not to hold post-treatment covariates at their observed values.

Definition: Let \(L_t\) denote covariates measured before treatment \(A_t\), for \(t=0,\ldots,K-1\), and let \(L_K\) denote covariates measured after the last treatment. Let \(Y\) be the outcome. A fixed treatment intervention is a specified sequence \(\bar a=(a_0,\ldots,a_{K-1})\) that sets \(A_t=a_t\) at each time. The intervention mean is \(\psi(\bar a)=E[Y^{\bar a}]\), where \(Y^{\bar a}\) is the outcome that would be observed under that sequence.

Here \(L_0\) is baseline, and each later \(L_{t+1}\) may depend on the covariates and treatments up through time \(t\). The formula below applies to a mean outcome; for a binary outcome, that mean is a risk. The target population is represented by the distribution of \(L_0\). A contrast, such as \(\psi(\bar a)-\psi(\bar a')\), compares population means under two specified sequences.

Identification and the longitudinal g-formula

The formula uses the observed conditional distribution of each covariate transition and the observed conditional mean of the outcome. Its identifying assumptions are substantive, not consequences of fitting parametric models.

  • Consistency: if a person’s treatment history equals \(\bar a\), the observed outcome and covariate history agree with their counterfactual history under \(\bar a\). The intervention must specify treatment sufficiently well that its versions are meaningful.
  • Sequential exchangeability: at each time, conditional on the measured history available before treatment, treatment assignment is independent of the relevant future counterfactual covariates and outcome. This rules out unmeasured confounding at each decision time.
  • Positivity and regularity: the intervention values must be supported by the treatment process for histories in the target population. With continuous treatment, identification at a particular value also requires suitable regularity of the conditional distributions at that value; for example, continuity there. A parametric model can return a prediction outside well-supported data, but that alone does not identify the prediction.
  • No interference: one individual’s intervention does not change another individual’s outcome.
Theorem: Under consistency, sequential exchangeability, positivity and regularity at the specified treatment values, and no interference, the intervention mean is
$$ \psi(\bar a) = \int E[Y\mid \bar L_K=\bar l_K,\bar A_{K-1}=\bar a]\, f(l_0) \prod_{t=0}^{K-1} f(l_{t+1}\mid \bar l_t,\bar A_t=\bar a_t) \,d\bar l_K . $$

Here \(\bar L_t=(L_0,\ldots,L_t)\) and \(\bar A_t=(A_0,\ldots,A_t)\). The notation \(d\bar l_K\) means integration over continuous covariates and summation over discrete ones. For a fixed \(\bar a\), the conditional covariate models and outcome mean are evaluated at the corresponding treatment values.

To justify the formula, consider the distribution of covariates under the intervention. Baseline \(L_0\) has the target-population distribution \(f(l_0)\). By sequential exchangeability, the conditional distribution of \(L_{t+1}\) under treatment \(a_t\), given its preceding history, is identified by the observed conditional distribution at that treatment and history. Consistency links these observed histories to the counterfactual histories. Applying this argument successively gives the product of transition distributions in the integrand. The same assumptions and consistency identify the conditional outcome mean at the completed history. Averaging that conditional mean over the intervention-specific covariate distribution gives the displayed expression. \(\square\)

The parametric g-formula replaces these conditional distributions and the outcome mean with fitted models. For example, one may fit a model for \(L_{t+1}\) given \(\bar L_t,\bar A_t\), and a model for \(E[Y\mid\bar L_K,\bar A_{K-1}]\). The models must allow the treatment level to enter flexibly enough for the intended comparisons; a linear term is not automatically adequate for a continuous exposure.

Worked calculations

Worked Example: A Nonlinear Dose Contrast

Suppose \(L\) is a baseline binary covariate with \(P(L=1)=0.4\), and a fitted conditional outcome-mean model is \(E[Y\mid A=a,L]=2+0.5L+1.2a-0.1a^2+0.4aL\). Calculate the intervention means at doses \(a=2\) and \(a=4\).

At \(a=2\), for \(L=0\), the predicted mean is \(2+1.2(2)-0.1(2^2)=4\). For \(L=1\), it is \(4+0.5+0.4(2)=5.3\). Thus \( \psi(2)=0.6(4)+0.4(5.3)=2.4+2.12=4.52\).

At \(a=4\), the prediction for \(L=0\) is \(2+1.2(4)-0.1(4^2)=5.2\). For \(L=1\), it is \(5.2+0.5+0.4(4)=7.3\). Therefore \( \psi(4)=0.6(5.2)+0.4(7.3)=3.12+2.92=6.04\). The estimated mean difference is \(6.04-4.52=1.52\). This is a population contrast: it averages over the baseline distribution rather than comparing two conditional predictions at one value of \(L\).

Worked Example: Simulating a Two-Time Treatment Sequence

Consider two treatments \(A_0,A_1\), a binary intermediate covariate \(L_1\), and a continuous outcome. Suppose \(P(L_1=1\mid A_0=a_0)=0.2+0.1a_0\), and \(E[Y\mid A_0=a_0,L_1,A_1=a_1]=10+2a_0+a_1+4L_1\). Compare fixed sequences \((1,1)\) and \((3,3)\). These probabilities are valid at both stated levels.

Under \((1,1)\), the transition probability is \(P(L_1=1)=0.2+0.1(1)=0.3\). The outcome mean conditional on \(L_1=0\) is \(10+2(1)+1=13\), and conditional on \(L_1=1\) it is \(13+4=17\). Hence \(\psi(1,1)=0.7(13)+0.3(17)=9.1+5.1=14.2\).

Under \((3,3)\), \(P(L_1=1)=0.2+0.1(3)=0.5\). The conditional means are \(10+2(3)+3=19\) and \(19+4=23\). Hence \(\psi(3,3)=0.5(19)+0.5(23)=9.5+11.5=21\). The contrast is \(21-14.2=6.8\).

The intermediate covariate distribution changes because the first treatment changes. Reusing the observed \(L_1\) distribution for both sequences would omit that pathway.

Worked Example: Integrating Over a Continuous Baseline Covariate

Let \(L\sim N(0,1)\) in the target population, with conditional outcome mean \(E[Y\mid A=a,L]=1+2a-0.5a^2+aL+0.5L^2\). Find the intervention means at \(a=1\) and \(a=2\).

Since \(E[L]=0\) and \(E[L^2]=\operatorname{Var}(L)+(E[L])^2=1\), integration over baseline \(L\) gives \(\psi(a)=1+2a-0.5a^2+aE[L]+0.5E[L^2]=1.5+2a-0.5a^2\). Thus \(\psi(1)=1.5+2-0.5=3\), while \(\psi(2)=1.5+4-2=3.5\). The mean difference is \(0.5\). The \(aL\) interaction disappears from this marginal mean because \(L\) is centered, but the nonlinear treatment term remains.

Parametric evaluation by simulation

In realistic longitudinal settings, the integral may be too complicated to calculate directly. A simulation implementation draws baseline covariates from the target population, then draws each subsequent covariate from its fitted transition model after inserting the intervention treatment value. It finally predicts the outcome mean for each simulated history and averages those predictions.

For fitted models, let \(\hat\psi_M(\bar a)\) be the average of the predicted outcome means from \(M\) independently simulated histories. Conditional on the fitted models, these histories are independent draws from the fitted intervention distribution. If the predicted means have finite variance, then

$$ E[\hat\psi_M(\bar a)\mid\text{fitted models}]=\hat\psi(\bar a), \qquad \operatorname{Var}(\hat\psi_M(\bar a)\mid\text{fitted models}) = \frac{\operatorname{Var}(\hat m(\bar L_K,\bar a)\mid\bar a,\text{fitted models})}{M}. $$

The first equality follows because expectation of an average is the average of expectations, and each simulated history has the fitted intervention distribution. For the second, the variance of a sum of independent draws is the sum of their variances; dividing by \(M^2\) yields the factor \(1/M\). The strong law of large numbers also gives \(\hat\psi_M(\bar a)\xrightarrow{a.s.}\hat\psi(\bar a)\) conditional on the fitted models. This controls simulation error, not uncertainty from estimating the models or bias from misspecification.

1
Draw baseline histories.
Sample \(L_0\) from the empirical target population or its fitted distribution.
2
Insert the fixed treatment values.
At each time, use \(a_t\) in the fitted covariate transition model to generate \(L_{t+1}\).
3
Predict and average.
Evaluate the fitted outcome mean on each generated history and average predictions across histories.

Interpretation, diagnostics, and a common pitfall

A fixed continuous level is an intervention on treatment, not a statement that individuals with that observed level are comparable to everyone else. The g-formula uses fitted conditional models to build the population history that would follow the intervention. In contrast, an unstandardized comparison of observed outcomes among people who happened to receive different doses can reflect differences in their histories as well as treatment effects.

A common mistake is to substitute \(A_t=a_t\) only into the outcome model while retaining each person’s factual post-treatment covariates. That computes predictions for a hybrid of the observed world and the intervention world. If treatment changes a later covariate, that covariate’s distribution must also be generated under the intervention. The correction is to apply the intervention value at every time in the relevant transition models, then average the outcome predictions over the resulting histories.

Basic checks include confirming that the intervention values use the same units and coding as the fitted models, that generated covariates are plausible, and that predicted outcomes are sensible across the simulated histories. A model that predicts implausible transitions or outcomes can make the resulting contrast untrustworthy. Parametric g-computation is especially useful when conditional models and simulation are convenient; alternatives such as weighting use a different route to marginal contrasts and require their own modeling and assumptions. Neither the parametric formula nor simulation removes the need for causal identification assumptions or well-supported model specification.

Key takeaway: For each fixed continuous treatment sequence, replace treatment values in the conditional covariate and outcome models, generate the intervention-specific covariate histories, and average predicted outcomes over the target population. Comparing these standardized means yields the intervention contrast.

Check Your Understanding

Answer each question, then check the solutions below.

  1. In a longitudinal g-formula, why must post-treatment covariates generally be generated under each fixed treatment sequence?
  2. Suppose \(L\) is binary with \(P(L=1)=0.25\), and \(E[Y\mid A=a,L]=3+a+2L\). Calculate \(\psi(1)\) and \(\psi(2)\), and give their difference.
  3. What does increasing the number \(M\) of simulated histories reduce, and what does it not necessarily reduce?
  4. Name two assumptions needed to interpret the parametric g-formula contrast causally.

Solutions. (1) Treatment can affect later covariates, so their intervention-specific distribution is part of the population outcome calculation; factual covariates would represent the wrong history. (2) At \(a=1\), the means for \(L=0,1\) are 4 and 6, giving \(0.75(4)+0.25(6)=4.5\). At \(a=2\), they are 5 and 7, giving \(0.75(5)+0.25(7)=5.5\). The difference is \(1\). (3) Increasing \(M\) reduces Monte Carlo error in evaluating the fitted g-formula; it does not necessarily reduce model misspecification or sampling uncertainty in fitted parameters. (4) Examples include consistency, sequential exchangeability, positivity with regularity at the specified continuous levels, and no interference.

Clinical Biostats