The following code might be a bit more numerically stable:
logit treat $xvars
predit xb, xb
gen ipw=1
replace ipw=1/invlogit(xb) if treat==1
replace ipw 1/invlogit(-xb) if treat==0
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of sebastian baumeister
Sent: woensdag 28 maart 2007 17:22
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: inverse probability of treatment weights
hi nicola,
i can answer the first part of your question regarding the compuation
of inverse probability weights after probit/ logit:
logit treat $xvars
predit pi, p
gen ipw=1
replace ipw=1/pi if treat==1
replace ipw 1/(1-pi) if treat==0
the use them as pweights
[pw=ipw]
see
http://www.york.ac.uk/res/herc/teach/OHE-Booklet.pdf#search=
page 56
regards
sebastian
nicola.baldini2@unibo.it schrieb:
> I heard of inverse probability of treatment weights (IPTW) and would like to know if I am implementing them correctly on Stata (my data are PANEL).
> I estimated the probability of being treated:
> . logit treat y(t-1) exog
> . predict iptw
> Then I used them as (importance??) weights:
> . ivreg2 y (z1 z2 endog y(t-1) = exog) [iw=iptw]
> where y is a count variable, y(t-1) is past y (I am uncertain about using lagged y or a depreciated stock up to t-1; in the weighted equation, alternatively, I can use a "years-since treatment" time counter), z1 and z2 are proportions (endogenous; my key independent variables), endog are additional endogenous dummies, exog are exogenous, treat is the treatment dummy.
> The problem (?) is that the treatment happens no more than once during the period of observation. To put it differently: before the treatment, we are in regime 1: all endogenous are zero; after the treatment, we are in regime 2: z1>0 (other endogenous may or may not be zero). Change from regime 2 to 1 not possible. Thus, iptw = 1 for all t after the treatment, since I'm interested in y over the whole time period - before and after the treatment. Is it ok? Alternatively, is there any IV command with an inflated/hurdle/heckman regression in the first step?
>
> P.S. I have far more endogenous variables than exogenous: can I use time dummies and L2.y as instrustruments?
>
> Nicola
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
>
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/