Tutorials › Causal Inference › Edge G-Formula for Path-Specific Effects

Mediation and Path-Specific Effects · Tutorial 792 of 972

Edge G-Formula for Path-Specific Effects

Translate an edge intervention in a DAG into a standardized sum of observed conditional distributions, and see what assumptions are needed to interpret that sum causally.

Advanced 12 min read

What You'll Learn

  • Specify an edge intervention by assigning treatment values separately to outgoing edges.
  • Write the edge g-formula for a counterfactual outcome distribution and mean.
  • Substitute edge-specific treatment values into the relevant conditional distributions.
  • Sum over intermediate variables in a topological factorization.
  • Standardize over a baseline confounder in a path-specific calculation.
  • Distinguish calculating the formula from establishing that it identifies a causal effect.

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.

Definition: Let \(A\) be a treatment node in a directed acyclic graph (DAG). An edge intervention assigns a value \(a_e\) to each relevant directed edge \(e\) leaving \(A\). If the edges \(A\to M\) and \(A\to Y\) are assigned values \(a_1\) and \(a_0\), respectively, the counterfactual \(Y(a_1\text{ on }A\to M,\ a_0\text{ on }A\to Y)\) describes the outcome when those edge-specific inputs are used in the structural mechanisms for \(M\) and \(Y\).

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\).

$$ p\{y(a_e)\} = \sum_{v_1,\ldots,v_K} \left[ \prod_{i=1}^{K} p\!\left(v_i\mid \operatorname{pa}^{a_e}(V_i)\right) \right] p\!\left(y\mid \operatorname{pa}^{a_e}(Y)\right). $$

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\):

$$ \operatorname{E}\{Y(a_e)\} = \sum_{v_1,\ldots,v_K} \operatorname{E}\!\left[Y\mid\operatorname{pa}^{a_e}(Y)\right] \prod_{i=1}^{K} p\!\left(v_i\mid \operatorname{pa}^{a_e}(V_i)\right). $$

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.

Conditions for a causal interpretation: The displayed expression is the edge g-formula functional. To interpret it as the counterfactual distribution under an edge intervention, the causal graph and structural model must be appropriate, the relevant variables and conditional distributions must be observed, and consistency and positivity must hold. In the usual fully observed DAG setting, identification of a path-specific counterfactual also requires that the path-specific intervention be identifiable; a recanting witness can prevent the observed-data functional from identifying it. The formula itself does not establish that condition.

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:

$$ \begin{aligned} \operatorname{E}\{Y(1\text{ on }A\to M,\ 0\text{ on }A\to Y)\} &= \sum_{m=0}^{1} \operatorname{E}(Y\mid A=0,M=m)P(M=m\mid A=1)\\ &=(0.20)(0.40)+(0.70)(0.60)\\ &=0.08+0.42\\ &=0.50. \end{aligned} $$

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:

$$ \begin{aligned} \operatorname{E}\{Y(a_e)\} ={}& \sum_{m_1,m_2} \operatorname{E}(Y\mid A=0,M_1=m_1,M_2=m_2)\\ &\qquad{}\times P(M_2=m_2\mid A=0,M_1=m_1) P(M_1=m_1\mid A=1). \end{aligned} $$

For \(M_1=0\), its weight is \(1-0.60=0.40\). Given \(M_1=0\), the weighted outcome mean over \(M_2\) is:

$$ (0.80)(0.10)+(0.20)(0.40)=0.08+0.08=0.16. $$

For \(M_1=1\), its weight is \(0.60\). Given \(M_1=1\), the weighted outcome mean over \(M_2\) is:

$$ (0.50)(0.30)+(0.50)(0.80)=0.15+0.40=0.55. $$

Combining the two \(M_1\) strata gives:

$$ (0.40)(0.16)+(0.60)(0.55)=0.064+0.330=0.394. $$

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\):

$$ \begin{aligned} \operatorname{E}\{Y(a_e)\} =\sum_c P(c)\sum_m \operatorname{E}(Y\mid A=0,M=m,C=c)P(M=m\mid A=1,C=c). \end{aligned} $$

For \(C=0\), the stratum-specific mean is:

$$ (0.50)(0.10)+(0.50)(0.50)=0.05+0.25=0.30. $$

For \(C=1\), \(P(M=0\mid A=1,C=1)=1-0.80=0.20\), so the stratum-specific mean is:

$$ (0.20)(0.20)+(0.80)(0.70)=0.04+0.56=0.60. $$

Standardizing these values over the baseline distribution gives:

$$ (0.60)(0.30)+(0.40)(0.60)=0.18+0.24=0.42. $$

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.

1
Mark the edge assignments.
Record the treatment value assigned to every relevant edge leaving \(A\). Do not infer a single treatment value for the entire graph.
2
Replace treatment in each factor.
For each node with \(A\) as a parent, use the assigned value for that specific edge. Retain its other parents as variables.
3
Multiply and average.
Multiply the conditional factors in topological order, then sum or integrate over intermediate and baseline variables as appropriate.
4
Check causal identification separately.
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.

Key takeaway: The edge g-formula is built by replacing \(A\) with the assigned value separately in each child’s conditional distribution, multiplying the modified factors, and averaging over intermediate variables. This specifies and calculates an edge-intervention functional; causal identification still depends on the graph and assumptions.

Check Your Understanding

Use the edge assignments, not a single treatment value for the whole formula.

  1. 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\)?
  2. Why must the edge g-formula sum over \(M\) when calculating a marginal outcome mean?
  3. In the two-mediator example, why does the factor for \(M_2\) use \(A=0\) while the distribution of \(M_1\) uses \(A=1\)?
  4. How does a baseline variable \(C\) enter the formula when it is not fixed by intervention?
  5. Does writing an edge g-formula from observed conditional distributions alone prove that it identifies the path-specific counterfactual? Explain briefly.
Clinical Biostats