# Computing counterfactual query given an SCM and how it differs from computing interventional query?

Assuming we have the following structural causal model (SCM), with a confounder DAG structure, as follows:

Noise variables:

$$U_1 \sim \mathcal{N}(0,\,1)$$ $$U_2 \sim \mathcal{N}(0,\,1)$$ $$U_3 \sim \mathcal{N}(0,\,1)$$

SCM equations:

$$X1=5 U1$$

$$X2=5 X1 + 5 U2$$

$$X3 =5 X1 + 5 X2 + 5 U3$$

Suppose we observe: $$U1 = 0.2, \; U2 = 0.2, \; U3 = 0.2, \; X1 = 1, \; X2 = 6, \; X3 = 36$$

Can you please explain (step-by-step) with above example how we can compute the counterfactual query:

$$q(X2_{X1=-1}, X3_{X1=-1} \mid X1 = 1, X2 = 6, X3 = 36)$$

and how is it different to computing the interventional query (step-by-step)

$$q(X2, X3 \mid do(X1=-1))$$

How are the noise variables $$U1, \; U2, \; U3$$ handled/used when computing each of the two query types (the interventional query and the counterfactual query respectively)?

In general, you compute a counterfactual by performing three steps:

1. Abduction: Use evidence $$E=e$$ to determine the value of $$U.$$
2. Action: Modify the model, $$M,$$ by removing the structural equations for the variables in $$X$$ and replacing them with the appropriate functions $$X=x,$$ to obtain the modified model, $$M_x.$$
3. Prediction: Use the modified model, $$M_x,$$ and the value of $$U$$ to compute the value of $$Y,$$ the consequence of the counterfactual.

(from Causal Inference in Statistics: A Primer, by Pearl, Glymour, and Jewell, p. 96).

Normally, in the observation, you wouldn't already have been given $$U$$ such as you have been given: essentially the abduction step is already done. For Step 2 (Action), the modified model with $$X1=-1$$ looks like \begin{align*} X1&=-1\\ X2&=-5+5U2\\ X3&=-5+5X2+5U3 \end{align*} Now for Step 3 (Prediction), we plug in the values, normally computed, of $$U2=0.2$$ and $$U3=0.2,$$ to obtain the final results: \begin{align*} X1&=-1\\ X2&=-4\\ X3&=-24. \end{align*}

Now for the intervention approach, you actually don't compute the values of the $$U$$ at all, but the query you wrote we normally (pun intended, of course) interpret as $$E[X2, X3\mid\text{do}(X1=-1)].$$ To compute this, while we definitely perform graph surgery by removing all arrows into $$X1$$ and replacing it with $$-1,$$ we must bank on the distributions given to us. Given the standard normals for $$U1, U2,$$ and $$U3,$$ and the SCM \begin{align*} X1&=-1\\ X2&=-5+5U2\\ X3&=-5+5X2+5U3, \end{align*} as before, we get the distributions \begin{align*} X2&\sim\mathcal{N}(-5,\,25)\\ X3&\sim\mathcal{N}(-30,\,630), \end{align*} showing that $$E[X2\mid\text{do}(X1=-1)]=-5$$ and $$E[X3\mid\text{do}(X1=-1)]=-30.$$

• Thanks for explaning how to get the counterfactuals. So when computing the intervetional query $q(X2, X3 \mid do(X1=-1))$, what exactly happens with the noise variables $U$? Why are the noise variables $U$ not needed for interventional query and what is the difference in interpretation between the single query $q(X2, X3 \mid do(X1=-1))$ and the quantity $E[X2, X3\mid\text{do}(X1=-1)]$ you suggest to compute? Also, its $X3 \sim \mathcal{N}(-30,\,650)$ I assume. Apr 14 at 23:38