# Derivation of equation 7.6 in Pearl's Causailty (2nd ed): counterfactual given actual observations

Background: Pearl presents the following Equation (7.6) for the probability of a counterfactual, $$Y_{x'} = y'$$, given the observed quantities $$X=x, Y=y$$:

\begin{align} P(Y_{x'} = y'| X=x, Y=y) &= \frac{P(Y_{x'} = y', X=x, Y=y)}{P(X=x, Y=y)} \\ & = \sum_u P(Y_{x'}(u) = y')P(u|x,y), \end{align}

where $$u$$ is a particular realization of the exogenous variables $$U$$ that uniquely determine the rest of the system. He states that this derivation is allowed by equation (7.4) for joint probabilities with counterfactuals in them:

$$P(Y_x = y, X=x') = \sum_{u \in U'} P(u),$$

with $$U' = \{u : Y_x(u) = y, X(u) = x'\}$$. (In the book this set is specified under the summation itself which freaked me out too much.)

Question: I understand why (7.4) is defined as it is, but I can't see how it it is useful in deriving (7.6). Is it really the case that we should expand the numerator and denominator above in terms of two sums over some not very pleasant sets and then get to $$\sum_u P(Y_{x'}(u) = y')P(u|x,y)$$?

My thinking: I would have thought that a sane derivation would go something like

$$P(Y_{x'} = y'| X=x, Y=y) = \sum_u P(Y_{x'} = y'| X=x, Y=y, U=u)P(U=u|X=x, Y=y),$$ by the law of total probability, and we already have almost (7.6). Then presumably you could argue that $$Y_{x'}$$ is uniquely determined by $$u$$ so in fact $$P(Y_{x'} = y'| X=x, Y=y, U=u) = P(Y_{x'}(u) = y'),$$ which will be either 0 or 1 depending. If we take the twin networks approach presented some pages later it is clear that the counterfactual is independent of the observed quantities given $$U$$.

Reference: Pearl, J. 2009, Causality, Cambridge University Press.

Your equation: $$\begin{multline} P(Y_{x'} = y'| X=x, Y=y) = \\ \sum_u P(Y_{x'} = y'| X=x, Y=y, U=u)P(U=u|X=x, Y=y) \end{multline}$$ is, of course, correct. And I think that Pearl's version: $$P(Y_{x'} = y'| X=x, Y=y) = \sum_u P(Y_{x'}(u) = y')P(u|x,y)$$ is a (very) lax form of writing your equation.

Also, Pearl states, right after equation (7.6):

In other words, we first update $$P(u)$$ to obtain $$P(u | x, y)$$ and then use the updated distribution $$P(u | x, y)$$ to compute the expectation of the equality $$Y_{x^\prime}(u) = y^\prime$$.

Thus, it is always meant to be conditioned on $$X=x, Y=y$$.

With other words, the expression $$P(Y_{x'}(u) = y')$$ is to be understood as $$P(Y_{x'} = y'| X=x, Y=y, U=u)$$.

And I agree, that (7.4) is not relevant in any of this.

• Thank you. And what would we mean exactly by "the expectation of the equality"? Do we treat it like an indicator function as in my naive interpretation? Commented Aug 5, 2022 at 10:31
• Yes, this is again some weird wording: "expectation of an equality". More understandable would be the "expectation of the probability $P(Y_{x'} = y'| X=x, Y=y, U=u)$". Commented Aug 5, 2022 at 11:30