Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: pweights, propensity scores


From   Paul <[email protected]>
To   [email protected]
Subject   st: pweights, propensity scores
Date   Thu, 17 Jan 2013 16:14:52 -0500

Hi all,

I'm using propensity scores to estimate treatment effects, where
treatment is exogenous conditional on the propensity score. I'm using
an estimator from Wooldridge's 2010 text book, which is also discussed
in The Stata Journal (2008) 8, Number 3, pp. 334–353.

Specifically, the treatment effect is estimated using (1/N) sum
(T*Y/p) - (1/N) sum ((1-T)*Y/(1-p).

According to the Stata Journal article, this can be estimated using a
regression with pweights equal to the "inverse of the treatment
probability defined using the
propensity score." However, when I use just the sum of the weighted
variables, I get a different answer from the regression result.  I'm
not terribly familiar with pweights, so I could be making some dumb
mistake.

Below is my code.  Does anyone know what I'm doing wrong, or what the
correct way to implement this method is?

Thanks,
Paul

/* Regression using pweights */
gen ipw=1/p_x if treated==1
replace ipw=1/(1-p_x) if treated==0

reg y treated [pweight=ipw]

/* IPTW one variable */
gen w1=((treated-p_x)/(p_x*(1-p_x)))
gen w1_y=w1 *y

sum w1_y

/* IPTW two variables */
gen w2a_y=y*treated/p_x
gen w2b_y=y*(1-treated)/(1-p_x)

foreach type in a b{
  sum w2`type'_y
  local mean_w2`type' =r(mean)
}

di `mean_w2a'-`mean_w2b'

/* IPTW two variables weights sum to one */
bysort treated: egen w_ipw=total(ipw)
gen w3a_y=(1/w_ipw)*y*treated/p_x
gen w3b_y=(1/w_ipw)*y*(1-treated)/(1-p_x)

foreach type in a b{
  sum w3`type'_y
  local mean_w3`type' =r(mean)
}

di `mean_w3a'-`mean_w3b'

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index