Proving equation 3.3.12 in Angrist Pischke Mostly Harmless Econometrics (inverse probability weighting formula for ATT effect) On page 82 in Mostly Harmless Econometrics, there is a formula for the average treatment effect on the treatment, using propensity score, that is
$$\tag{1}
E(Y_{1i} - Y_{0i}\vert D_i =1) = E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))P(D_i=1)}\bigg]
$$
where $\rho(X_i) = prob(D_i=1\vert X_i) =E(D_i\vert X_i)$ is the propensity score. $D_i$ is a dummy variable for the treatment, $P(D_i=1)$ is the probability that $D_i=1$, and $X_i$ are covariates. Also, we have conditional independence assumption that $\{Y_{1i}, Y_{01}\}\perp D_i\vert X_i$
My question is how to prove (1). Preferably, I am looking for something that uses the Law of iterated expectations, as that is how Angrist and Pischke show the similar formula for the ATE.
Going by what the did for the ATE, and the fact that they say it is similar to show for the ATT, I believe I need to have start with showing something like
$$
E[\text{something}] = E[Y_{1i}\vert D_i=1]
$$
by using the law of iterations on the left-hand side. However, I don't know what to do for the "something".
I thought maybe I would just use what they used, where "something" is $\frac{Y_iD_i}{\rho(X_i)}$, but in order to get the expectation on the right conditional on $D_i$, I need to condition the left hand side on $D_i$ as well, and when I do that I don't get the propensity score in the denominator to cancel anymore, so I get confused.
Edit: Incase it is of any use, here is the formula for the ATE:
$$
E(Y_{1i} - Y_{0i}) = E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))\rho(X_i)}\bigg]
$$
which is derived from $E[\frac{Y_iD_i}{\rho(X_i)}] = E[Y_{1i}]$ and $[\frac{Y_i(1-D_i)}{(1-\rho(X_i)}] = E[Y_{0i}]$ which can be shown using Law of Iterated Expections and conditional independence assumption.
The only difference between the two formulas is one has the propensity score in the denominator and the other has $prob(D_i=1)$
 A: Since $\rho(X_i)=E(D_i|X_i)=P(D_i=1|X_i)$:
$$
E(Y_i D_i|X_i)=\rho(X_i) E(Y_{1i}|X_i) \\
\Rightarrow E(Y_{1i}|X_i)=\frac{1}{\rho(X_i)}E(Y_i D_i|X_i)
$$
similarly,
$$
E(Y_i (1-D_i)|X_i)=(1-\rho(X_i)) E(Y_{0i}|X_i) \\
\Rightarrow E(Y_{0i}|X_i)=\frac{1}{1-\rho(X_i)}E(Y_i (1-D_i)|X_i)
$$
We have
$$
E(Y_{1i} - Y_{0i}\vert X_i)\\
=\frac{1}{\rho(X_i)}E(Y_i D_i|X_i)-\frac{1}{1-\rho(X_i)}E(Y_i (1-D_i)|X_i)\\
=\frac{1}{\rho(X_i)(1-\rho(X_i))}E(Y_iD_i(1-\rho(X_i))-Y_i(1-D_i)\rho(X_i))\\
=\frac{1}{\rho(X_i)}E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))}\bigg\vert X_i\bigg]
$$
thus,
$$
\rho(X_i)E(Y_{1i} - Y_{0i}\vert X_i)=E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))}\bigg\vert X_i\bigg]
$$
Then, using the fact that $\rho(X_i)=E(D_i\vert X_i)$, and the conditional independence assumption:
$$
E(D_i(Y_{1i} - Y_{0i})\vert X_i)=E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))}\bigg\vert X_i\bigg]
$$
Using again, the law of iterated expectation we get:
$$
E(D_i(Y_{1i} - Y_{0i}))=E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))}\bigg]
$$
and then
$$
E(D_i(Y_{1i} - Y_{0i})\vert D_i=1)prob(D_i=1) + E[0\vert D_i=0]prob(D_i=0)=E\bigg[\frac{(D_i - \rho(X_i))Y_i}{(1-\rho(X_i))}\bigg]
$$
using the fact that $E[E[W\vert Z]]= E[W]$ and
$$
E\bigr[E[W\mid Z]\bigr] = \sum_x E[W\mid Z = z]\cdot p_Z(z)
$$
Lastly, noting that
$prob(D_i=1)$ is just a constant so we can put it inside the expectation, and that $E[0\vert D_i=0]=0$, we can divide both sides by $prob(D_i=1)$ and get the result.
$$
E((Y_{1i} - Y_{0i})\vert D_i=1)
=E\bigg[\frac{(D_i - \rho(X_i))Y_i}{prob(D_i=1)(1-\rho(X_i))}\bigg]
$$
where we don't write $D_i$ on the LHS because it is $1$ (because we condition on $D_i=1$).
