From a Threshold to a Treatment Path
A dynamic treatment rule makes treatment depend on information observed as follow-up proceeds. For example, a policy might assign treatment at a visit when a laboratory measurement is at least a specified threshold, and withhold it otherwise. The rule is not one fixed sequence of treatments for everyone: different measured histories can lead to different paths, and treatment at an earlier visit can affect the covariates that determine later assignments.
Consider two treatment times. Let \(L_1\) be a covariate measured before treatment \(A_1\), and let \(L_2\) be measured after \(A_1\) but before treatment \(A_2\). A history available at the first decision includes \(L_1\); the second decision can use \(L_1,A_1,L_2\). A threshold rule can use only the current covariate, or it can also depend on other recorded parts of the history.
For instance, if \(c_1=c_2=5\), the rule assigns \(A_1=1\) when \(L_1\geq5\), and assigns \(A_2=1\) when \(L_2\geq5\). The second assignment uses a covariate measured after the first treatment. Thus, although the same threshold is used at each time, the rule is adaptive: the distribution of \(L_2\), and consequently the second treatment, can depend on \(A_1\).
Worked Example: Tracing Paths Under a Threshold Rule
Suppose treatment is binary and the hypothetical rule is \(A_t=1\) if the measured covariate at visit \(t\) is at least 5, and \(A_t=0\) otherwise. For a two-visit sequence, identify the treatment path for each listed history.
| \(L_1\) | \(L_2\) | Rule assignment \(A_1\) | Rule assignment \(A_2\) | Path \((A_1,A_2)\) |
|---|---|---|---|---|
| 3.2 | 4.1 | 0 | 0 | (0, 0) |
| 3.2 | 5.8 | 0 | 1 | (0, 1) |
| 6.4 | 4.1 | 1 | 0 | (1, 0) |
| 6.4 | 5.8 | 1 | 1 | (1, 1) |
For the first history, \(L_1=3.2<5\), so the first assignment is 0; \(L_2=4.1<5\), so the second assignment is also 0. For the second, the first assignment remains 0 but \(L_2=5.8\geq5\), making the path \((0,1)\). The same reasoning gives \((1,0)\) and \((1,1)\) for the final two histories. These are rule-specified paths for the stated histories, not claims that every path has equal probability under the rule.
The table also shows why this is not equivalent to prescribing treatment 1 at both visits or treatment 0 at both visits. The rule selects a treatment separately at each decision, using the covariate available then.
The Counterfactual Mean Under the Rule
Let \(Y^d\) denote the outcome that would be observed if each person followed rule \(d\) throughout follow-up. The quantity of interest in this tutorial is the rule-specific counterfactual mean \(E[Y^d]\). To calculate it, average the outcome over the histories that would arise under the rule, rather than over histories generated under an unrelated treatment pattern.
For two treatment times, write the observed-data distributions as \(f(L_1)\), \(f(L_2\mid L_1,A_1)\), and the conditional outcome mean \(E(Y\mid L_1,A_1,L_2,A_2)\). When the conditions for the longitudinal g-formula hold, the rule-specific mean is obtained by setting each treatment in these conditional distributions to the value prescribed by the rule:
For discrete covariates, the integrals are replaced by sums. The rule is applied inside the expression: it determines the first treatment, which determines the treatment-conditioned distribution used for the next covariate, and then determines the second treatment. With a continuous \(L_2\), histories on both sides of its threshold contribute to the mean, weighted by their probabilities under the distribution induced by the first rule assignment.
Calculating a Mean With Discrete Histories
Worked Example: A Two-Visit Threshold Rule
Suppose a hypothetical study has a low or high covariate at each of two pre-treatment visits. At visit 1, the rule assigns \(A_1=1\) for a high \(L_1\) and \(A_1=0\) for a low \(L_1\). At visit 2 it assigns \(A_2=1\) for a high \(L_2\) and \(A_2=0\) for a low \(L_2\). Assume \(P(L_1=\text{low})=0.60\) and \(P(L_1=\text{high})=0.40\). Under the rule's first-stage assignments, suppose the probability that \(L_2\) is high is 0.25 for the low-\(L_1\) group and 0.60 for the high-\(L_1\) group.
Assume the following hypothetical conditional mean outcomes, measured in symptom-score points. The means apply to the histories and treatments specified by the rule.
| \(L_1\) | \(A_1\) | \(L_2\) | \(A_2\) | Conditional mean outcome |
|---|---|---|---|---|
| Low | 0 | Low | 0 | 10 points |
| Low | 0 | High | 1 | 16 points |
| High | 1 | Low | 0 | 18 points |
| High | 1 | High | 1 | 24 points |
First average over \(L_2\) within each \(L_1\) group, using the group-specific probability of high \(L_2\). In the low-\(L_1\) group, the high-\(L_2\) probability is 0.25, so the low-\(L_2\) probability is \(1-0.25=0.75\). The group's rule-specific mean is
In the high-\(L_1\) group, the high-\(L_2\) probability is 0.60 and the low-\(L_2\) probability is \(1-0.60=0.40\). Its rule-specific mean is
Finally, average these two conditional means over the baseline distribution of \(L_1\):
Under the stated assumptions and distributions, the estimated rule-specific mean is 15.54 symptom-score points. The calculation weights each later history by its probability under the rule's earlier treatment, then weights the resulting means by the baseline covariate distribution.
Integrating Across a Continuous Threshold
When the covariate is continuous, a threshold divides its distribution into regions assigned different treatments. The probability in each region matters: the rule-specific mean averages over all possible covariate values, not just values equal to the threshold. For a normally distributed covariate, a threshold probability can be calculated from the standard normal cumulative distribution function \(\Phi\).
Worked Example: A Continuous Covariate at the Second Decision
Consider a hypothetical two-visit setting. At the first visit, \(L_1\) is low for 60% of the population and high for 40%; the threshold rule therefore sets \(A_1=0\) in the low group and \(A_1=1\) in the high group. Conditional on these rule-assigned first treatments, suppose \(L_2\) follows the distributions below. At the second visit, the rule sets \(A_2=1\) when \(L_2\geq0.5\), and \(A_2=0\) otherwise. Assume the conditional mean outcome is \(10+2A_1+3A_2+0.5L_2\) points.
| \(L_1\) group | Probability of group | Rule-set \(A_1\) | Distribution of \(L_2\) |
|---|---|---|---|
| Low | 0.60 | 0 | \(N(0,1)\) |
| High | 0.40 | 1 | \(N(1,1)\) |
Here the second argument of \(N(\mu,\sigma^2)\) is the variance, so both distributions have standard deviation 1. For \(L_2\sim N(0,1)\), the standardized threshold is \(z=(0.5-0)/1=0.5\). Thus,
For the high-\(L_1\) group, \(L_2\sim N(1,1)\), so the standardized threshold is \(z=(0.5-1)/1=-0.5\). By symmetry of the standard normal distribution, \(1-\Phi(-0.5)=\Phi(0.5)=0.6915\). The rule therefore assigns the second treatment more often in the high group, according to these stipulated distributions.
Within the low group, \(E[L_2]=0\), \(A_1=0\), and the probability that \(A_2=1\) is 0.3085. Averaging the conditional outcome mean gives
Within the high group, \(E[L_2]=1\), \(A_1=1\), and the probability that \(A_2=1\) is 0.6915. Its mean is
Averaging across the two \(L_1\) groups gives
The counterfactual mean under this rule is approximately 12.39 points. The calculation integrates over the continuous \(L_2\) distribution by using the probability above the threshold for the \(A_2\) term and the distributional mean for the \(L_2\) term. It does not replace all covariate values by a single representative value.
A Short Justification of the Substitution
The g-formula for a dynamic rule follows by averaging over the covariate histories that would occur while following that rule. For two decision times, first condition the counterfactual outcome on \(L_1\) and \(L_2\). Under the rule, the first treatment is \(d_1(L_1)\), and the second treatment is the value prescribed for the resulting history. Iterated expectation then averages the conditional outcome mean over the rule-induced distribution of \(L_2\), and over the distribution of \(L_1\):
Consistency and sequential exchangeability identify the conditional outcome mean for each rule-compatible history with the corresponding observed conditional mean. Sequential exchangeability also permits the covariate distribution after the first rule assignment to be represented by the observed distribution conditional on that assignment. Therefore,
and the conditional outcome mean is evaluated at \(A_1=d_1(L_1)\) and \(A_2=d_2(L_1,d_1(L_1),L_2)\). Substituting these terms yields the displayed longitudinal g-formula. Positivity is needed so the observed data include support for the rule-prescribed treatment at histories contributing to this average. The formula is an identification result; with estimated distributions, the numerical answer also depends on the adequacy of the estimation procedure.
Common Pitfall: Treating the Threshold as a Fixed Regimen
A common error is to translate “treat when the covariate is above 5” into a single fixed path, such as \((1,1)\), and then average outcomes for people observed to have received that path. That reasoning ignores both people whose covariate falls below the threshold and the fact that the second covariate may be affected by the first treatment. It also conditions on observed treatment histories rather than reconstructing the histories that would arise under the rule.
The correction is to apply the rule at each decision in sequence. First set \(A_1=d_1(L_1)\); then use the covariate distribution conditional on that assigned first treatment; next set \(A_2=d_2(H_2)\); and finally average the outcome mean over all rule-generated histories. This is why a threshold-based rule is evaluated with the g-formula rather than by selecting one observed treatment sequence.
Check Your Understanding
Use the definitions and calculations above to answer the following questions.
- Under the rule \(A_t=I(L_t\geq4)\), what is the two-visit treatment path when \(L_1=3.5\) and \(L_2=4.2\)?
- Why can the distribution of \(L_2\) under a dynamic rule depend on the rule's first treatment assignment?
- In the discrete worked example, what probability was used for the low-\(L_2\) history in the high-\(L_1\) group, and how was it obtained?
- For \(L_2\sim N(2,1)\) with a treatment threshold of 3, express the probability of second-stage treatment using \(\Phi\).
- Name two assumptions needed to interpret the g-formula mean as the counterfactual mean under the rule, and state briefly what each requires.