Creative Commons License
This pyAgrum's notebook is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License
Author: Aymen Merrouche and Pierre-Henri Wuillemin.

**Mini Turing Test**

This notebook follows the example from "The Book Of Why" (Pearl, 2018) chapter 1 page 046.

The Ladder Of Causation

In order for a prisoner to be executed, a certain chain of events must take place. First, the court gives the execution order to the captain. Then, the captain gives the signal to the firing squad (two soldiers A and B) to shoot the prisoner. Finally, the soldiers obey the commandment and shoot at the prisoner.

We create the causal diagram:

The corresponding causal diagram is the following:

1- Answering observational queries (rung one of the ladder of causation) :

Consists of finding variables that are associated by collecting and analyzing raw data. It allows us to answer queries based on passive observation of data If I observe variable $ X $, what can I say about variable $ Y $? (i.e $ P (Y \mid X) $)

If the prisoner is dead, does that mean the court order was given?

i.e. We are interested in distribution: $$P(court order \mid death = 1)$$

If the prisoner is dead, this means that both soldiers fired, the captain gave the signal to the firing squad and the court ordered the execution.

Suppose we find out that A fired. What does that tell us about B?

i.e. We are interested in distribution: $$P(soldierB \mid soldierA = 1)$$

Following the diagram, we can say that B fired too since A wouldn't have fired if the captain didn't give the signal.

2- Answering interventional queries (rung two of the ladder of causation) :

Consists of predicting the effect of a deliberate intervention What would $ X $ be, if I do $ Y $? (i.e. $P(X \mid do(Y))$) Interventional queries can not be answered using only passively collected data.

What if Soldier A decides on his own initiative to fire, without waiting for the captain’s command? Will the prisoner be dead or alive?

Even if the captain didn't give the command to the firing squad, the prisoner still died we soldier A decided to shoot him.

Subset {captain} meets the back-door criterion relative to (soldier A, death) because:

  • 1- no node in {captain} is a descendant of "soldier A"
  • 2- {captain} blocks every path between "soldier A" and "death" that contains an arrow into "death"

So {captain} satisfies the back-door criterion relative to (soldier A, death), the causal effect of "soldier A" over "death" is given by the formula $$P(death ∣ do(soldierA = 1)) = \sum_{captain}{P(death ∣ captain,soldierA).P(captain)}$$

What if Soldier A decides on his own initiative to fire, without waiting for the captain’s command? What does that tell us about Soldier B?

A’s spontaneous decision shouldn't affect variables in the model that are not descendants of A. If we see that A shot, we conclude that B shot too (he wouldn't have shot without the captain's order). But if we make A shoot spontaneously without waiting for the captain's order, we have no information about B. This is the difference between seeing and doing.

What if the captain decides on his own initiative to give the firing order, without waiting for the court order’s command?

Subset {soldier A, soldier B} meets the front-door criterion relative to (captain, death) because:

  • 1- {soldier A, soldier B} intercepts all directed paths from "captain" to "death"
  • 2- There is no back-door path from "captain" to {soldier A, soldier B}.
  • 3- All back-door paths from {soldier A, soldier B} to "death" are blocked by "captain."

3- Answering counterfactual queries (rung three of the ladder of causation) :

Consists of reasoning about hypothetical situations What would have happened if?

Suppose the prisoner is lying dead on the ground. From this, we can conclude (using level one) that A shot, B shot, the captain gave the signal, and the court gave the order. But what if A had decided not to shoot? Would the prisoner be alive?

To answer this question we need to compare the real world where the prisoner is lying dead on the ground, A shot, B shot, the captain gave the signal to the firing squad and the court gave the order : $$death = 1 \mid soldier A = 1 \mid soldier B = 1 \mid captain=1 \mid court order = 1$$ With a counterfactual world where "$soldier A = 0$", and where the arrow leading into A is erased (since he decided on his own not to shoot we emancipate it from the effect of the captain).

Even if A decides not to shoot in the counterfactual world, the court did give the order to the captain who gave the signal to the firing squad including A who decided not to shoot, however, B shot and killed the prisoner.

Mathematically, this counterfactual is the following conditional probability: $$P(death^* \mid soldier A^*=0,soldier A=1, captain=1,court order=1,death=1)$$ where variables with an ∗ are unobserved (and unobservable) variables that live in the counterfactual world, while variables without ∗ are observable.