Many thanks to both: the results are exactly the same in more than 95% of the cases, and their ratio is between .99999952 and .99999994 in the remaining ones. All ipw>1, while I expected some of them to be = 1. Remember that my data are panel and that my treatment variable is like "being married" in a world where no death/divorce is observable. Therefore e.g.
id=1 t=1 : single (treatment=0)
id=1 t=2 : marriage (treatment=1)
id=1 t=3 : still married (treatment=1)
...
id=1 t=n : still married (treatment=1)
Is it ok to have ipw > 1 for all n observations pertaining to id number 1, or should I manually correct it to 1 for the "still married" observations?
What do you think about using some -st- command in lieu of the logit? When I was younger, I have been told that -st- are continuous time models, while logit is for discrete time ones. But then, I found several empirical papers using survival analysis with time-varying covariates measured once a year, as in my dataset. Is the choice between the two commands just a matter of taste??
At 02.33 29/03/2007 -0400, you wrote:
>The following code might be a bit more numerically stable:
>
>logit treat $xvars
>predict 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
>predict 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/