Deriving the result $\mathbb{E}[Y\mid A=a] = \frac{\mathbb{E}[Y\cdot\mathbf{1}\{A=a\}]}{P(A=a)}$

25 Views Asked by At

It is a well known result that $$ \mathbb{E}[Y\mid A=a] = \frac{\mathbb{E}[Y\cdot\mathbf{1}\{A=a\}]}{P(A=a)}. $$ To derive this result, one would proceed as below: $$ \begin{align} \mathbb{E}[Y\cdot\mathbf{1}\{A=a\}] & = \sum_{a'} \mathbb{E}[Y\cdot\mathbf{1}\{A=a\}|A=a']P(A=a')\\ & = 0 + \cdots + \mathbb{E}[Y\cdot\mathbf{1}\{A=a\}|A=a]P(A=a)\\ & = \mathbb{E}[Y|A=a]P(A=a). \end{align} $$ The result this follows from the last line as $$ \mathbb{E}[Y\mid A=a] = \frac{\mathbb{E}[Y\cdot\mathbf{1}\{A=a\}]}{P(A=a)}. $$ My question is whether the following would also be a valid derivation: $$ \begin{align} \mathbb{E}[Y\mid A=a] & = \frac{\sum_{y} y \cdot P(Y=y,A=a)}{P(A=a)} \\ & = \frac{\sum_{y} \sum_{a'} y\cdot \mathbf{1}\{A=a\} \cdot P(Y=y,A=a')}{P(A=a)} \\ & = \frac{\mathbb{E}[Y\cdot\mathbf{1}\{A=a\}]}{P(A=a)}. \end{align} $$ I believe that the first and second line of the above derivation should be equal as I have restricted the summation $\sum_{a'}$ to only allow for one non-zero term to be summed up. Furthermore, the second line fits the definition of a bivariate expectation such that this derivation should hold.

If this derivation is correct, it would seem a bit more straightforward than the standard one given at the beginning of this question.