Why the Edge g-Formula Is Needed
A path-specific effect asks what would happen to an outcome if treatment were allowed to influence it along some directed paths, but not others. An edge intervention expresses this question by assigning treatment values separately to the treatment node’s outgoing edges. The edge g-formula then gives a recipe for calculating the resulting counterfactual distribution from conditional distributions in a causal model.
The essential operation is local: for each variable, use its usual conditional distribution given its parents, but replace the treatment value in that distribution whenever treatment is one of its parents. Then multiply the resulting factors and sum over intermediate variables. This is not the same as setting treatment to one value everywhere in the data analysis.
For a path-specific effect, edges on paths designated as active receive one treatment value, and edges on paths designated as inactive receive a reference value. The assignments are made to edges, not to whole variables: a variable downstream of treatment can be affected by treatment through one incoming route while another incoming route receives the reference value.
Writing the Edge g-Formula
Consider the ancestors of an outcome \(Y\), ordered topologically as \(V_1,\ldots,V_K,Y\), with treatment \(A\) omitted from this list. A topological order places each variable after its parents. The set \(\operatorname{pa}(V_i)\) denotes the parents of \(V_i\) in the DAG. For each \(V_i\), form \(\operatorname{pa}^{a_e}(V_i)\) by replacing \(A\) with the assigned value on the edge \(A\to V_i\), if that edge exists. Leave every other parent at its variable value. Apply the same rule to the parents of \(Y\).
The sum ranges over all values of the non-outcome variables in the factorization, including baseline variables when they are not fixed. For continuous variables, replace the relevant sums with integrals. If \(Y\) is continuous, the left side is a density and the final factor is its conditional density. For a mean outcome, the same formula weights the conditional mean of \(Y\):
A factor for a baseline variable is simply its distribution, such as \(p(c)\), because it has no treatment parent. The factor for a mediator that has treatment as a parent uses the value assigned to the edge entering that mediator. A downstream factor uses the assigned value for its own treatment edge, but retains the values of its other parents as they are summed over.
How the Formula Follows From the DAG
Under a Markovian structural causal model, each variable is generated by a function of its parents and an independent error term. The observed-data distribution therefore factorizes into one conditional distribution per node. For an edge intervention, the mechanism for a child of \(A\) receives the assigned edge value in place of \(A\); mechanisms for other variables retain their usual parent inputs. Multiplying these modified conditional distributions gives the joint distribution induced by the edge intervention. Summing out the non-outcome variables leaves the distribution of \(Y(a_e)\).
This argument explains the calculation, but it is not by itself a proof that the resulting observed-data functional identifies every path-specific effect. For that step, the graph must permit the required edge intervention to be identified. In particular, a formula assembled from observed conditionals should not be treated as causal merely because all its terms can be estimated.
Worked Example: A Mediated Path and a Direct Path
Suppose the DAG has edges \(A\to M\), \(M\to Y\), and \(A\to Y\), where \(A\), \(M\), and \(Y\) are binary. The target edge intervention assigns \(A=1\) on \(A\to M\) and \(A=0\) on \(A\to Y\). The following hypothetical conditional probabilities and outcome means are assumed to come from a correctly specified, fully observed causal model with positivity and no recanting witness:
- \(P(M=1\mid A=1)=0.60\), so \(P(M=0\mid A=1)=0.40\).
- \(\operatorname{E}(Y\mid A=0,M=0)=0.20\).
- \(\operatorname{E}(Y\mid A=0,M=1)=0.70\).
The mediator factor uses \(A=1\), because that value is assigned to \(A\to M\). The outcome factor uses \(A=0\), because that value is assigned to \(A\to Y\). Thus:
The edge-intervention counterfactual mean is \(0.50\), or 50% on the binary outcome scale. This calculation combines the mediator distribution under treatment with the outcome mechanism at the reference treatment value. It does not estimate the effect of setting \(A=1\) for everyone, because the outcome’s direct treatment input is set to zero.
Worked Example: Two Mediators in Sequence
Now consider a DAG with edges \(A\to M_1\), \(A\to M_2\), \(M_1\to M_2\), \(M_1\to Y\), \(M_2\to Y\), and \(A\to Y\). Assign \(A=1\) on \(A\to M_1\), but assign \(A=0\) on both \(A\to M_2\) and \(A\to Y\). The conditional values below are hypothetical. Assume the model and identification conditions needed to interpret the edge formula are satisfied.
- \(P(M_1=1\mid A=1)=0.60\).
- For \(M_2\), \(P(M_2=1\mid A=0,M_1=0)=0.20\) and \(P(M_2=1\mid A=0,M_1=1)=0.50\).
- The outcome means \(\operatorname{E}(Y\mid A=0,M_1,M_2)\) are \(0.10\) for \((M_1,M_2)=(0,0)\), \(0.40\) for \((0,1)\), \(0.30\) for \((1,0)\), and \(0.80\) for \((1,1)\).
The formula multiplies the distribution of \(M_1\) under its assigned treatment input by the conditional distribution of \(M_2\) under its own assigned treatment input, then averages the outcome mean over both mediators:
For \(M_1=0\), its weight is \(1-0.60=0.40\). Given \(M_1=0\), the weighted outcome mean over \(M_2\) is:
For \(M_1=1\), its weight is \(0.60\). Given \(M_1=1\), the weighted outcome mean over \(M_2\) is:
Combining the two \(M_1\) strata gives:
The counterfactual mean is \(0.394\), or 39.4% for a binary outcome. Notice that the \(M_2\) conditional distribution uses \(A=0\) even though \(M_1\) is distributed as it would be under \(A=1\). That is exactly the edge-specific assignment in this example.
Worked Example: Standardizing Over a Baseline Confounder
Let \(C\) be a binary baseline variable with arrows to \(A\), \(M\), and \(Y\). The other edges are \(A\to M\), \(A\to Y\), and \(M\to Y\). Assign \(A=1\) on \(A\to M\) and \(A=0\) on \(A\to Y\). Suppose the following hypothetical values are available:
- \(P(C=1)=0.40\), hence \(P(C=0)=0.60\).
- For \(C=0\), \(P(M=1\mid A=1,C=0)=0.50\); for \(C=1\), \(P(M=1\mid A=1,C=1)=0.80\).
- For \(C=0\), the outcome means at \(A=0\) are \(0.10\) when \(M=0\) and \(0.50\) when \(M=1\).
- For \(C=1\), the corresponding means are \(0.20\) and \(0.70\).
The baseline distribution is averaged over rather than fixed. Within each \(C\) stratum, the mediator distribution uses \(A=1\), while the outcome mean uses \(A=0\):
For \(C=0\), the stratum-specific mean is:
For \(C=1\), \(P(M=0\mid A=1,C=1)=1-0.80=0.20\), so the stratum-specific mean is:
Standardizing these values over the baseline distribution gives:
The edge-intervention mean is \(0.420\), or 42.0%. If the comparison intervention assigns \(A=0\) on both \(A\to M\) and \(A\to Y\), then the same calculation gives \(0.268\): the stratum means are \((0.80)(0.10)+(0.20)(0.50)=0.18\) for \(C=0\), and \((0.60)(0.20)+(0.40)(0.70)=0.40\) for \(C=1\); standardizing yields \((0.60)(0.18)+(0.40)(0.40)=0.268\). The contrast is \(0.420-0.268=0.152\), or 15.2 percentage points. This is a causal contrast only under the stated identification conditions.
Reading and Using the Formula Carefully
The formula is easiest to construct in topological order. Start with baseline variables and write their distributions. Move through each mediator or other intermediate variable, substituting the treatment value assigned to its incoming treatment edge. Finish with the conditional outcome distribution or mean, again using the value assigned to the edge into the outcome. Finally, sum or integrate over all variables not fixed by design.
Record the treatment value assigned to every relevant edge leaving \(A\). Do not infer a single treatment value for the entire graph.
For each node with \(A\) as a parent, use the assigned value for that specific edge. Retain its other parents as variables.
Multiply the conditional factors in topological order, then sum or integrate over intermediate and baseline variables as appropriate.
Confirm that the graph, assumptions, and positivity support interpreting the observed-data functional as the target counterfactual.
A common mistake is to use one treatment level in every factor because there is one treatment variable. For example, setting \(A=1\) in both \(p(m\mid A)\) and \(\operatorname{E}(Y\mid A,m)\) computes a different intervention from setting \(A=1\) on \(A\to M\) and \(A=0\) on \(A\to Y\). The correction is to annotate each treatment parent separately before writing any conditional distribution.
A second pitfall is to treat positivity as a technical afterthought. The conditional means in the formula must be supported by observations in the relevant treatment and covariate strata. If a mediator level has zero probability under the edge-specific treatment value for a covariate stratum, the required conditional outcome information may not be available there. Extrapolating a model into such unsupported combinations does not make the causal quantity nonparametrically identified.
Check Your Understanding
Use the edge assignments, not a single treatment value for the whole formula.
- In a DAG with \(A\to M\), \(A\to Y\), and \(M\to Y\), what treatment values appear in the mediator and outcome factors for an intervention assigning 1 on \(A\to M\) and 0 on \(A\to Y\)?
- Why must the edge g-formula sum over \(M\) when calculating a marginal outcome mean?
- In the two-mediator example, why does the factor for \(M_2\) use \(A=0\) while the distribution of \(M_1\) uses \(A=1\)?
- How does a baseline variable \(C\) enter the formula when it is not fixed by intervention?
- Does writing an edge g-formula from observed conditional distributions alone prove that it identifies the path-specific counterfactual? Explain briefly.