# Front door formula - calculation in practice

I am reading about the front door criterion and I want to make sure that I understand what is calculated in the second part of the formula, where the backdoor path between $$Z$$ and $$Y$$ is blocked by conditioning on $$X.$$

Graph:

Formula:

$$P(y|\operatorname{do}(X=x))=\sum_z P(z|x)\sum_{x'}P(y|x',z)\,P(x')$$

Using the graph and the formula above and assuming that all variables except $$U$$ are binary and $$U$$ is unobserved, if I am interested in the effect of $$\operatorname{do}(X = 1)$$ where $$x$$ set to $$1$$ on $$y = 1,$$ is the calculation below correct?:

1. Calculate the sum of $$P(z = 1 | x = 1)$$ and $$P(z = 0 | x = 1).$$
2. Calculate the sum of $$P(y = 1 | z = 1, x = 1)$$ and $$P(y = 1 | z = 1, x = 0)$$
3. Multiply [result of step 1] * [result of step 2].

Is this right?

• I don't see any conditional probabilities in your calculations, but every probability in the front-door adjustment formula is conditional. That leads me to doubt seriously whether your calculations are correct. Nov 25, 2020 at 16:27
• I edited it Adrian, thank you. What I would like to understand is, if in the second part of forula, z is always set to 1 and we sum over the whole range of x ?
– Milo
Nov 25, 2020 at 17:10
• Please use the standard vertical pipe notation for conditionals: $P(z=1|x=1).$ Nov 25, 2020 at 17:11

It's not quite as simple as that: there is a $$z$$ in the inner sum so that the two sums are nested, not independent. Also, you need to be very careful about the order of operations. You really need to calculate the following: \begin{align*} \underbrace{P(y|\operatorname{do}(X=x))}_{y=1,\,x=1} &=\sum_z P(z|x)\sum_{x'}P(y|x',z)\,P(x')\\ &=P(z=0|x=1)\left[\sum_{x'}P(y=1|x',z=0)\,P(x')\right]\\ &\qquad+P(z=1|x=1)\left[\sum_{x'}P(y=1|x',z=1)\,P(x')\right] \end{align*}
• Yes, that's correct. According to the usual rules of writing sums, and which variables are bound and which are not, the $z$ in the second sum shows you that it has to be a nested sum, and not independent. Nov 25, 2020 at 18:30