Description
First of all, thank you for making this very accessible book!
In the section about continuous treatment in chapter 20, you defined
to be the pseudo-outcome1 and then you threw away the denominator since you are interested in comparing treatment effects, not their absolute values. But doing so does not preserve order2. Instead why don't we just simplify it to be
Now onto the actual issue: the code block that came after
is
y_star_cont = (train["price"] - train["price"].mean()
*train["sales"] - train["sales"].mean())
but this is missing some parentheses, so it actually computes
Footnotes
-
The denominator I assume is an estimate of the conditional variance Var(T|X), but for most regression methods this residual is an underestimate. ↩
-
In the end we will average those values up to estimate the CATE. But unlike the randomized treatment case where every term is scaled by σ² and can be un-scaled without changing order, here each term has a different factor. ↩