would have attained had $A$ been set to $a'$. Given $p(a, M(a'))$, the *natural direct effect* (NDE) (on the expectation difference scale) is defined as ${\mathbb{E}}[Y(a, M(a'))] - {\mathbb{E}}[Y(a')]$, and the *natural indirect effect* (NID) is defined as ${\mathbb{E}}[Y(a)] - {\mathbb{E}}[Y(a, M(a'))]$. Under certain identification assumptions discussed by [@pearl01direct], the distribution of $Y(a, M(a'))$ (and thereby direct and indirect effects) can be nonparametrically identified from observed data by the following formula: [$$\begin{aligned}
    p(Y(a, M(a')) = \sum_{X, M} \ p(Y \mid a, X, M) \ p(M \mid a', X) \ p(X).\end{aligned}$$ ]{}More generally, when there are multiple pathways from $A$ to $Y$ one may define various *path-specific effects* (PSEs). In this case, effect along a particular path will be obtained by comparing two potential outcomes, one where for the selected paths all nodes behave as if $A = a$, and along all other paths nodes behave as if $A = a'$.

PSEs are defined by means of nested, path-specific potential outcomes. Fix a set of treatment variables $A$, and a subset of *proper causal paths* $\pi$ from any element in $A$. A proper causal path only intersects $A$ at the source node. Next, pick a pair of value sets $a$ and 