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]

Re: st: pweights, propensity scores


From   Christophe Kolodziejczyk <ck.statalist@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: pweights, propensity scores
Date   Fri, 18 Jan 2013 09:59:44 +0100

Hi Paul
I think you have to compute the weighted mean separately for the
different samples, i.e the first weighted sum should be divided by the
number of treated and the second sum should be divided by the number
of controls.


logit treatment X
predict p

gen w = cond(treatment,1/p,1/(1-p))

reg y treatment [w=w]

sum y if treatment [w=w]
local m1 = `r(mean)'
sum y if !treatment [w=w]
local m0 = `r(mean)'

di "ATE = " `=`m1'-`m0''



Best
Christophe


2013/1/17 Paul <paulburk314@gmail.com>:
> 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/



-- 
Christophe Kolodziejczyk
Research Fellow

AKF, Anvendt KommunalForskning
Danish Institute of Governmental Research
Købmagergade 22
DK-1150 København K

*
*   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