From a Treatment Sequence to an Intervention Rule
A static treatment regime specifies the treatment to assign at each follow-up time without making that assignment depend on a participant’s evolving covariate history. The sequence might be “no treatment at the first visit, then treatment at the next two visits.” To use the longitudinal g-formula, it is helpful to express each entry of that sequence as a rule that applies at the corresponding time. This makes explicit which parts of the observed data distribution remain relevant under intervention and which part—the observed treatment assignment mechanism—is replaced.
Use \(K\) treatment times, indexed \(t=0,\ldots,K-1\). Let \(L_t\) be the covariates measured before \(A_t\), and let \(H_t=(\bar L_t,\bar A_{t-1})\) denote the observed history just before that treatment. Here \(\bar L_t=(L_0,\ldots,L_t)\) and \(\bar A_{t-1}=(A_0,\ldots,A_{t-1})\), with the treatment history empty at \(t=0\). After the final treatment \(A_{K-1}\), let \(L_K\) denote any covariates measured before the outcome \(Y\). Thus each treatment has a subsequent covariate transition, including \(A_{K-1}\) followed by \(L_K\).
For a categorical treatment, the intervention can be written using point-mass factors: at time \(t\), the intervention assigns probability one to \(A_t=a_t\) and zero to other values. If treatment is binary, this factor is \(I(A_t=a_t)\). These intervention factors are not estimated treatment probabilities. They encode what is set by the intervention.
Worked Example: Encoding a Four-Visit Sequence
Suppose there are four treatment times, \(t=0,1,2,3\), and the desired regimen is \(\bar a=(0,1,1,0)\), where 1 denotes treatment and 0 denotes no treatment.
The four rules are \(d_0(h_0)=0\), \(d_1(h_1)=1\), \(d_2(h_2)=1\), and \(d_3(h_3)=0\), regardless of the histories \(h_t\). The corresponding intervention factors are \(I(A_0=0)\), \(I(A_1=1)\), \(I(A_2=1)\), and \(I(A_3=0)\). Their product is one precisely for a treatment path matching the specified sequence.
In the observed data, the probability of this path would instead involve conditional assignment probabilities such as \(g_t(a_t\mid h_t)=P(A_t=a_t\mid H_t=h_t)\). Those probabilities describe how treatment was assigned, not what the intervention does. The distinction is central: the static regime fixes the treatment values, while the g-formula averages over covariate histories that evolve under those fixed values.
The Regime-Specific G-Formula
Write \(q_t(l_{t+1}\mid h_t,a_t)\) for the conditional density or mass function of \(L_{t+1}\) given history \(H_t=h_t\) and treatment \(A_t=a_t\). This definition applies through \(t=K-1\), so \(q_{K-1}\) describes \(L_K\) after the final treatment. Let \(m(y\mid\bar l_K,\bar a_{K-1})\) be the conditional density or mass function of \(Y\) given the complete covariate history and treatment history. The observed-data factorization is
The outcome factor is written outside the product: it appears once, after all treatment and covariate transitions. Under the intervention \(\bar a\), the treatment factors \(g_t\) are replaced by the fixed assignments \(A_t=a_t\). The resulting regime-specific outcome distribution is
For discrete covariates, the integrals are sums. The regime-specific mean follows by taking the conditional mean \(\mu(\bar l_K,\bar a_{K-1})=E[Y\mid\bar L_K=\bar l_K,\bar A_{K-1}=\bar a_{K-1}]\) and integrating it against the same regime-induced covariate distribution:
Here sequential exchangeability means that, conditional on \(H_t\), treatment assignment at time \(t\) is independent of the relevant future counterfactual covariates and outcome under the regime. Positivity means \(P(A_t=a_t\mid H_t=h_t)>0\) for almost every history \(h_t\) that has positive probability under the regime through time \(t\). These conditions are needed at every treatment time, not only at baseline.
The formula’s justification is sequential. The baseline covariate law is the observed \(f(l_0)\). Given a history reached under the regime, exchangeability and consistency allow the observed conditional transition law for \(L_{t+1}\) under \(A_t=a_t\) to represent that counterfactual transition. Positivity ensures this conditional law is supported by observed data. Applying this argument in order for \(t=0,\ldots,K-1\) gives the product of the \(q_t\) factors. At the final history, the same exchangeability and consistency argument identifies the conditional outcome law. Integrating over the resulting covariate-history distribution gives the stated outcome distribution and mean. The observed \(g_t\) factors do not appear because treatment is set, not drawn from its observed assignment distribution. \(\square\)
Worked Example: Calculating a Regime-Specific Risk
Let \(K=2\), and suppose \(L_0=0\) for everyone. Both \(L_1\) and \(L_2\) are binary. Consider the static regimen \(\bar a=(1,0)\). The covariate transition models are
Suppose the outcome is binary and its conditional risk is
Under the regimen, \(A_0=1\) and \(A_1=0\). First average the second transition over \(L_1\):
The outcome risk is 0.3 when \(L_2=0\), because \(0.1+0.2(1)+0.1(0)+0.2(0)=0.3\); it is 0.5 when \(L_2=1\). Therefore,
The calculation averages outcomes over covariates generated under the fixed sequence. It does not average over the observed probabilities of receiving \(A_0=1\) or \(A_1=0\).
Why the Treatment Factors Are Replaced
The replacement can also be seen directly in the factorization. For observed data, a treatment path has conditional probability \(\prod_t g_t(a_t\mid h_t)\). Under a deterministic intervention, the corresponding path is assigned probability one if it matches \(\bar a\), and zero otherwise. In the intervention distribution, summing over treatment values therefore selects \(a_t\) at each time; it does not retain or multiply by \(g_t(a_t\mid h_t)\). The covariate transitions remain because covariates are not fixed by a static treatment regimen. Their distributions can change as a consequence of the assigned treatments.
This is why the g-formula handles treatment-confounder feedback. A covariate affected by earlier treatment can influence later treatment and the outcome. Under a fixed regime, the covariate still evolves according to its transition law under the assigned treatment, even though later treatment is no longer generated by the observed assignment mechanism.
Worked Example: Positivity Can Fail for a Fixed Sequence
Consider one treatment time, a binary baseline covariate \(L_0\), and a static regimen \(A_0=1\). Suppose \(P(L_0=0)=0.6\) and \(P(L_0=1)=0.4\). In the observed data, \(P(A_0=1\mid L_0=0)=0.5\), but \(P(A_0=1\mid L_0=1)=0\). Among people with \(L_0=0\), suppose the observed risk under treatment is 0.2.
The g-formula for the intervention requires the treated outcome risk in both baseline strata:
The first conditional risk is 0.2, but the second is not observed because treatment is never assigned when \(L_0=1\). If that unobserved risk were 0.1, the regime risk would be \((0.6)(0.2)+(0.4)(0.1)=0.16\). If it were 0.9, the regime risk would be \((0.6)(0.2)+(0.4)(0.9)=0.48\). Both values are compatible with the stated observed treatment pattern, so the regime risk is not identified from these data without additional assumptions. The intervention rule is easy to write; lack of support prevents the required causal comparison.
Assumptions, Diagnostics, and Common Pitfalls
The formula is a causal identification result, not a guarantee that a fitted model estimates the target well. In applications, one typically estimates the conditional covariate transitions and outcome regression, then combines them according to the formula. Each model must be adequate for the histories and treatment values used by the regime. Diagnostics should therefore ask whether those histories have data support and whether fitted conditional distributions are plausible, rather than only whether the treatment sequence itself was observed often.
- Check regime-specific support. At each time, examine whether the assigned treatment occurs across histories likely to arise under the regime. Sparse or empty strata indicate positivity problems.
- Check the history definition. Include covariates measured before treatment in \(H_t\), and do not omit the post-final-treatment covariate transition \(q_{K-1}\) when \(L_K\) is measured before \(Y\).
- Check the intervention encoding. Verify that every time point has exactly one assigned value and that its timing matches the study protocol.
- Check conditional-model behavior. Implausible predicted transition probabilities, extreme extrapolations, or outcome predictions outside the outcome’s possible range suggest model or support problems.
A common mistake is to keep the observed treatment assignment probabilities in the regime-specific g-formula. The mistaken reasoning is that every factor in the observed-data factorization should remain when evaluating the regime. But \(g_t\) describes how treatment was assigned in the observational process; under the intervention, treatment is set to \(a_t\). Keeping \(g_t\) would weight histories by the chance of naturally following the sequence, changing the target away from the outcome distribution under assignment to that sequence.
Another mistake is to multiply the outcome factor once per treatment time. The outcome law is conditional on the completed history and appears once, after all covariate transitions. Likewise, \(L_K\) must be included only when it is part of the observed timing: if covariates are measured after the last treatment and before \(Y\), the final transition law is \(q_{K-1}(l_K\mid h_{K-1},a_{K-1})\). Omitting it changes the history on which the outcome model is conditioned.
The parametric g-formula and inverse-probability weighting are alternative g-methods for estimating regime-specific quantities. The g-formula models covariate evolution and the outcome conditional on history; inverse-probability weighting instead uses treatment probabilities to reweight observed data. Their modeling demands and finite-sample behavior differ, but neither method removes the need for causal assumptions or adequate support. For continuous treatment, assigning an exact point value may require stronger smoothness or structural assumptions than ordinary positivity; a conditional density being positive near a value does not by itself establish nonparametric identification at that exact point.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- For \(K=3\), write the static rules for the sequence \((1,0,1)\).
- Why does the regime-specific g-formula retain the covariate transition laws but omit the observed treatment assignment probabilities?
- If \(L_K\) is measured after \(A_{K-1}\) and before \(Y\), which transition law generates it?
- At a history reached under a proposed regime, the assigned treatment has observed conditional probability zero. What does this imply for the g-formula?
Solutions. (1) The rules are \(d_0(h_0)=1\), \(d_1(h_1)=0\), and \(d_2(h_2)=1\); each is constant across histories. (2) Treatment is set by intervention, so its observational assignment mechanism is replaced; covariates remain stochastic and evolve under the assigned treatment, so their conditional transition laws must still be averaged over. (3) The final transition \(q_{K-1}(l_K\mid h_{K-1},a_{K-1})\) generates \(L_K\). (4) Positivity fails on that regime-reached history. The needed conditional law is unsupported by observed data, so the g-formula is not identified there without additional assumptions.