# Why does conditioning on a mediator variable makes the ancestor and the child independent?

The example and question are from the book Book of Why by Judea Pearl.

Suppose we have three random variables: $$A \rightarrow B \rightarrow C$$. $$B$$ is a mediator. Conditioning on $$B$$ would screen-off the effect of $$A$$ on $$C$$ and $$A$$ and $$C$$ becomes independent. Independence means, knowing the value of one variable does not affect the probability of the other.

Now let's say the specific random variables are: $$Fire \rightarrow Smoke \rightarrow Alarm$$, $$Smoke$$ is a mediator. If we say $$Smoke=1$$, all the values in both $$Fire$$ and $$Alarm$$ will be 1, as $$Fire$$ causes $$Smoke$$ that causes the $$Alarm$$ to go off. It was dependent and it's dependent now. Every row in the conditional probability table is either full 1s or full 0s. If we know that if $$Fire=1$$ then $$Alarm=1$$.

+------+-------+-------+
| Fire | Smoke | Alarm |
+------+-------+-------+
| 0    | 0     | 0     |
+------+-------+-------+
| 0    | 0     | 0     |
+------+-------+-------+
| 1    | 1     | 1     |
+------+-------+-------+
| 0    | 0     | 0     |
+------+-------+-------+
| 1    | 1     | 1     |
+------+-------+-------+


I don't get the part, that conditioning on a mediator makes them independent. If we know $$Fire$$ we know the value of $$Alarm$$. Conditioning on $$Smoke$$ doesn't change that at all, so why did it render $$A$$ and $$C$$ or $$Fire$$ and $$Alarm$$ independent?

What am I missing?

If we know 𝐹𝑖𝑟𝑒 we know the value of 𝐴𝑙𝑎𝑟𝑚. Conditioning on 𝑆𝑚𝑜𝑘𝑒 doesn't change that at all, so why did it render 𝐴 and 𝐶 or 𝐹𝑖𝑟𝑒 and 𝐴𝑙𝑎𝑟𝑚 independent?

Yes, if we know the value of fire we know the value of alarm. But this is not what conditioning on smoke means. Conditioning on smoke means we know the value of smoke, but do not know the value of fire. More generally, conditioning on an event means that this event is treated as being known to have occurred (with that event's cause being perhaps unknown).

There are many ways there can be smoke. Someone lights a cigarette, someone sautés food on a pan that's too hot, or a fire starts. A fire causes smoke, but it's only one such cause. If we are conditioning on smoke, then we know there is smoke but do not know the smoke's cause. But the smoke's cause is irrelevant - the alarm will go off independent of whether or not a fire was the cause of the smoke. Hence, we say the alarm going off is conditionally independent of fire given smoke.

• I think I understand, thanks! May 25, 2020 at 16:16

Formally, you model implies $$P(Alarm|Smoke) = P(Alarm|Smoke, Fire)$$.

In short, Fire and Alarm are independent conditional on Smoke.

In words, if you know there is smoke, then you can infer there is an alarm. The additional knowledge of fire does not change you assessment, because there is no other path between fire and alarm.

Note that in your particular dataset, it is also the other way around: $$P(Alarm|Fire) = P(Alarm|Smoke, Fire)$$. That is, if you know there is a fire, you are certain that there is an alarm, and learning that there is also smoke does not change this. This is not implied by the DAG, and will not generally be the case. For example, imagine that there is be a fire, but a strong wind blows away the smoke from the alarm. Then not every fire would lead to an alarm, and learning that there is no smoke in addition to learning that there is a fire will lead you to predict that the alarm does not go off.

• Unfortunately, I can't accept 2 answers, If I could, I would accept this too! Thanks Julian! May 25, 2020 at 16:16