Solved – Calculating weights for inverse probability weighting for the treatment effect on the untreated/non-treated

econometricspropensity-scoresstata

I am trying to calculate weights for inverse probability weighting. For ATE and ATET the process is straightforward. For example in Stata:

predict ps if e(sample)

gen ate=1/ps if treatment==1
replace ate=1/(1-ps) if treatment==0

gen atet=1 if treatment==1
replace atet=ps/(1-ps) if treatment==0

My question is: how can i calculate the weights for the non-treated (ATENT)?

Best Answer

For ATU, the weights on $y_i$ would be $$ w_i = \begin{cases} \frac{1 - \hat p(x_i)}{\hat p(x_i)} & \text{if}\ d_i=1 \\ 1 & \text{if}\ d_i=0, \end{cases} $$ where $d_i$ is the binary treatment indicator.

For ATT/ATET, the weights are $$ w_i = \begin{cases} 1 & \text{if}\ d_i=1 \\ \frac{\hat p(x_i)}{1-\hat p(x_i)} & \text{if}\ d_i=0 \end{cases} $$

For ATE, the weights are $$ w_i = \begin{cases} \frac{1}{\hat p(x_i)} & \text{if}\ d_i=1 \\ \frac{1}{1-\hat p(x_i)} & \text{if}\ d_i=0 \end{cases} $$

You can find these formulas derived on pages 67-69 of Micro-Econometrics for Policy, Program and Treatment Effects by Myoung-jae Lee, except that I broke them into two pieces here.

Here's how I might do this in Stata, with native commands when possible and also by hand with a weighted regression of the outcome on a binary treatment dummy:

cls
set more off
webuse cattaneo2, clear
/* (0) Get the phats */
qui probit mbsmoke mmarried c.mage##c.mage fbaby medu
predict double phat, pr
/* (1a) ATE */
teffects ipw (bweight) (mbsmoke mmarried c.mage##c.mage fbaby medu, probit), ate
/* (1b) ATE By Hand */
gen double ate_w =cond(mbsmoke==1,1/phat,1/(1-phat))
reg bweight i.mbsmoke [pw=ate_w], vce(robust)
/* (2a) ATT */
teffects ipw (bweight) (mbsmoke mmarried c.mage##c.mage fbaby medu, probit), atet
/* (2b) ATT by Hand */
gen double att_w =cond(mbsmoke==1,1,phat/(1-phat))
reg bweight i.mbsmoke [pw=att_w], vce(robust)
/* (3) ATU by Hand Only */
gen double atu_w =cond(mbsmoke==1,(1-phat)/phat,1)
reg bweight i.mbsmoke [pw=atu_w], vce(robust)

This gives the following three effects of maternal smoking on newborn weight:

  • ATU = -231.8782 grams
  • ATT = -225.1773 grams
  • ATE = -230.6886 grams
Related Question