# The average treatment effect and the difference in means

Hi I have a question related to the treatment effect.

Recently, I am reading literatures on treatment effect and have a question.

In the literatures, we denote the counterfactual outcomes as $$Y_1$$ and $$Y_0$$ where $$Y_1$$ is for the treated and $$Y_0$$ is for the untreated. Then, the observed outcome is $$Y=W\cdot Y_1+(1-W)\cdot Y_0$$ where $$W$$ is the indicator of the treatment.

Here, my first question is whether or not $$E(Y_1|W=1)$$ and $$E(Y|W=1)$$ are different?

Second, I found an equation that is as follows: \begin{aligned} E(Y|W=1)-E(Y|W=0) &= E(Y_1-Y_0)\\ &+\{E(Y_1|W=1)-E(Y_1|W=0)\}P(W=0)\\ &+\{E(Y_0|W=1)-E(Y_0|W=0)\}P(W=1) \end{aligned} where P() is the probability function. But, I can't derive the equation.

To answer your first question, we have $$E(Y | W = 1) = E(W\cdot Y_1 + (1 - W) \cdot Y_0 | W = 1) = E(Y_1 | W = 1)$$ where the last equality follows by the fact that we are allowed to plug in the conditioned value of $$W$$ when evaluating the conditional expectation, so yes, they are equal. Of course, a similar argument shows that $$E(Y | W = 0) = E(Y_0 | W = 0)$$. I end up using both of these facts below:
\begin{aligned} E(Y_1) &= E(Y_1 | W = 1)P(W = 1) + E(Y_1 | W = 0) P(W = 0)\\ &= E(Y_1 | W = 1)[1 - P(W = 0)] + E(Y_1 | W = 0) P(W = 0)\\ &= E(Y_1 | W = 1) - \{E(Y_1 | W = 1) - E(Y_1 | W = 0)\} P(W = 0)\\ &= E(Y | W = 1) - \{E(Y_1 | W = 1) - E(Y_1 | W = 0)\} P(W = 0) \end{aligned}
\begin{aligned} E(Y_0) &= E(Y_0 | W = 1)P(W = 1) + E(Y_0 | W = 0) P(W = 0)\\ &= E(Y_0 | W = 1)P(W = 1) + E(Y_0 | W = 0) [1 - P(W = 1)]\\ &= E(Y_0 | W = 0) + \{E(Y_0 | W = 1) - E(Y_0 | W = 0)\} P(W = 1)\\ &= E(Y | W = 0) + \{E(Y_0 | W = 1) - E(Y_0 | W = 0)\} P(W = 1) \end{aligned}
\begin{aligned} E(Y|W=1)-E(Y|W=0) &= E(Y_1-Y_0)\\ &+\{E(Y_1|W=1)-E(Y_1|W=0)\}P(W=0)\\ &-\{E(Y_0|W=1)-E(Y_0|W=0)\}P(W=1) \end{aligned}