Why Compute Backward?
With repeated treatment and covariate measurements, a regime-specific mean depends on a chain of events: baseline characteristics, treatment, later covariates, subsequent treatment, and finally the outcome. The product g-formula expresses this mean by averaging over the possible covariate histories generated under the regime. Recursive g-computation performs the same averaging in a different order: it first averages the outcome over the last covariate, then carries that conditional mean backward through earlier covariates.
This order is useful because it exposes the nested structure of the calculation. At each step, one takes a conditional expectation over the next covariate distribution under the treatment specified by the regime. It also makes clear that treatment values are set by the intervention; they are not averaged over their observed-treatment distribution.
Histories and the Backward Recursion
Consider \(K\) treatment times. At baseline, \(L_0\) is measured before treatment \(A_1\). For each \(t=1,\ldots,K\), treatment \(A_t\) is followed by covariates \(L_t\). The outcome \(Y\) is measured after \(L_K\). Define the history available just before treatment \(A_t\) as \(H_t=(L_0,A_1,L_1,\ldots,A_{t-1},L_{t-1})\); thus \(H_1=L_0\). A regime \(\bar d=(d_1,\ldots,d_K)\) assigns \(A_t=d_t(H_t)\). A static regime assigns fixed treatment values, whereas a dynamic regime can assign different values for different histories.
Write \(Y^{\bar d}\) for the outcome that would be observed under regime \(\bar d\). The target is its population mean, \(E[Y^{\bar d}]\). The recursion below is a way to evaluate the g-formula for that mean; it does not by itself establish that the mean is identified from observed data.
The definition uses the observed conditional outcome expectation at the end, then works backward. At step \(t\), the treatment is set to the value required by the regime at history \(h_t\), and the next covariate \(L_t\) is averaged over its conditional distribution at that history and treatment. For discrete \(L_t\), this conditional expectation is a sum; for continuous \(L_t\), it is an integral. The final expectation averages over the baseline distribution in the target population.
To interpret the conditional distributions as regime-specific quantities, the standard identification conditions are needed. Consistency requires that a person's observed outcome and covariates agree with their counterfactuals when their observed treatment history follows the specified regime. Sequential exchangeability requires that, at each treatment time, conditional on the measured pre-treatment history, treatment assignment is independent of the relevant future counterfactual covariates and outcome. Positivity requires that each treatment value prescribed by the regime has positive probability at histories the regime can reach. These conditions, together with a well-defined intervention and appropriately measured histories, justify using the observed conditional distributions in the recursion.
Why the Recursion Gives the Product G-Formula
For discrete covariates, the product g-formula averages the terminal conditional outcome mean over all covariate histories, multiplying the conditional probabilities of the covariates along each history under the regime. The recursive form is obtained by carrying out those sums from the last covariate backward. Treatment probabilities do not appear in the product: each treatment is set to its regime value.
The expression is written compactly: in a dynamic regime, each \(d_t(h_t)\) depends on the history along the summation path. To see the backward step, hold the history through time \(t-1\) fixed and sum over \(l_t\). The conditional probability of \(L_t=l_t\) multiplies the quantity for the remaining future history. By the definition of conditional expectation, that sum is exactly \(Q_t(h_t)\). Repeating this operation for \(t=K,K-1,\ldots,1\) leaves the baseline average \(E[Q_1(L_0)]\).
This is an application of iterated expectation: averaging a quantity over a later variable conditional on its history, and then averaging the result over the earlier history, gives the same overall average as summing over all variables at once. No approximation is involved in this rearrangement when the same conditional distributions and regime values are used.
Worked Example: One Treatment Time and One Later Covariate
Suppose a hypothetical study records binary treatment \(A_1\), a binary post-treatment covariate \(L_1\), and a binary outcome \(Y\). Consider the static regime \(A_1=1\). Among people with \(A_1=1\), suppose the observed conditional distribution gives \(P(L_1=1\mid A_1=1)=0.40\), and the conditional outcome means are \(E[Y\mid A_1=1,L_1=1]=0.80\) and \(E[Y\mid A_1=1,L_1=0]=0.20\). Assume consistency, sequential exchangeability, and positivity for this regime.
First set the terminal conditional mean to \(Q_2(A_1,L_1)=E[Y\mid A_1,L_1]\). Under the regime, the recursion averages that mean over \(L_1\):
Thus the identified mean outcome under the regime is 0.44, or a 44% outcome risk. This calculation averages over the post-treatment covariate rather than holding it fixed. The causal interpretation depends on the stated identification assumptions; the arithmetic alone does not prove them.
Worked Example: Two Treatment Times, Recursing Through Later Covariates First
Consider a hypothetical two-time study with binary \(L_1,L_2\) and outcome \(Y\). Under the static regime \(A_1=A_2=1\), suppose \(P(L_1=1\mid A_1=1)=0.40\). The later covariate probabilities under \(A_2=1\) are \(P(L_2=1\mid L_1=1,A_1=1,A_2=1)=0.70\) and \(P(L_2=1\mid L_1=0,A_1=1,A_2=1)=0.20\). Suppose the outcome means under the regime are 0.80 when \((L_1,L_2)=(1,1)\), 0.50 when \((1,0)\), 0.40 when \((0,1)\), and 0.10 when \((0,0)\). Assume the identification conditions hold at both treatment times and that the required treatment probabilities are positive.
Start with the terminal means \(Q_3(L_1,L_2)=E[Y\mid A_1=1,L_1,A_2=1,L_2]\). For \(L_1=1\), average over \(L_2\) under \(A_2=1\):
For \(L_1=0\), the corresponding average is:
Now average these two results over \(L_1\) under \(A_1=1\):
The regime-specific mean is 0.380, or a 38.0% risk. The order matters computationally: the outcome is averaged over \(L_2\) first, conditional on \(L_1\), and the resulting values are then averaged over \(L_1\). This is the same sum as the product g-formula, grouped into nested conditional expectations.
Dynamic Regimes in the Same Recursion
The recursion does not require a static regime. For a dynamic regime, the treatment inserted at each step is determined by the history at that step. Consequently, a history-specific treatment rule must be applied before using the conditional distribution of the next covariate. The resulting conditional expectation is then carried backward in the same way.
Worked Example: A Later Treatment Depends on an Earlier Covariate
In a hypothetical two-time setting, consider the rule \(A_1=1\), followed by \(A_2=L_1\): assign the later treatment when \(L_1=1\), and do not assign it when \(L_1=0\). Suppose \(P(L_1=1\mid A_1=1)=0.40\). Under the rule's prescribed \(A_2=1\) when \(L_1=1\), let \(P(L_2=1\mid L_1=1,A_1=1,A_2=1)=0.60\), with outcome means 0.90 for \(L_2=1\) and 0.60 for \(L_2=0\). When \(L_1=0\), the prescribed \(A_2=0\); let \(P(L_2=1\mid L_1=0,A_1=1,A_2=0)=0.25\), with outcome means 0.30 for \(L_2=1\) and 0.10 for \(L_2=0\). Assume consistency, sequential exchangeability, and positivity for both prescribed treatment choices at histories reached under the rule.
At \(L_1=1\), apply the rule's treatment \(A_2=1\), then average over \(L_2\):
At \(L_1=0\), the rule prescribes \(A_2=0\), so the relevant conditional distribution and outcome means are those for that treatment:
Finally, average over the distribution of \(L_1\) under the first prescribed treatment:
The regime-specific mean is 0.402, or a 40.2% risk. In particular, the later treatment value changes with \(L_1\); using the \(A_2=1\) covariate distribution for both values of \(L_1\) would not evaluate this rule.
Common Pitfalls and Practical Checks
The recursion is simple to state, but its indexing and conditioning are easy to mishandle. Each step averages over the next covariate conditional on the history so far and the treatment assigned by the regime. After that covariate is integrated out, the resulting quantity is a function of the earlier history and can be averaged at the preceding step.
- Using observed treatment frequencies as part of the regime average. The regime sets \(A_t=d_t(H_t)\). The g-formula averages over covariate distributions under those assigned values; it does not average over the probability of receiving the treatment naturally observed at each time.
- Integrating a covariate under the wrong treatment. The distribution for \(L_t\) must be conditional on the regime-prescribed \(A_t\), including a history-specific value under a dynamic rule.
- Skipping a covariate history. If the covariate affects later treatment or the outcome, its value must be retained in the history until its role in the backward expectation has been accounted for.
- Treating identification as automatic. A numerical recursion based on observed conditional distributions identifies a counterfactual mean only when consistency, sequential exchangeability, and positivity are credible for the histories the regime can reach.
A useful audit is to write down the terminal conditional outcome mean, then list each covariate distribution to be averaged over in reverse time order. At every step, check that the conditioning history is pre-treatment for the treatment being set, that the regime value is applied at that history, and that the final result is averaged over the intended baseline population.
Check Your Understanding
Use the definitions and examples above to answer the following.
- In the recursion, what is averaged at the \(t\)th step, and which treatment value conditions that expectation?
- Why does a dynamic regime require evaluating \(d_t(h_t)\) at each history rather than inserting one fixed treatment value everywhere?
- For a two-time regime, explain why \(L_2\) is averaged before \(L_1\) in the backward calculation.
- Which identification condition is most directly threatened if a regime prescribes a treatment value never observed at a history the regime can reach?
- In the final worked example, what would be incorrect about using the \(A_2=1\) conditional distribution of \(L_2\) when \(L_1=0\)?