Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Simulating failure times using discrete-time event history analysis

 From Maarten buis To statalist@hsphsun2.harvard.edu Subject Re: st: Simulating failure times using discrete-time event history analysis Date Thu, 8 Jul 2010 00:38:23 -0700 (PDT)

```--- On Wed, 7/7/10, Wallace, Geoffrey P wrote:
> I am conducting an event history analysis using
> discrete-time data looking at the decision to ratify a
> number of international human rights treaties. The unit of
> analysis is the country-year. The main specification for the
> models is as follows, which uses cubic splines and a count
> variable to capture duration dependence.
>
> . logit treatyvar indepvars timecount spline1 spline2
> spline3, vce(cluster country)
>
> To explore substantive effects I've used the Clarify ado
> package to estimate the predicted probability of failure
> (ratify the treaty) based on different values for the
> explanatory variables.
>
> Rather than just the probability of failure, what I want to
> do is estimate the probable length of time it would take to
> fail based on setting different values for the explanatory
> variables, measured by the number of years, though still
> allowing for a fraction of a year (e.g. 2.5 years). I think
> it makes most sense to specify the length of time until
> failure as occurring once Probability(failure) is greater
> than 0.5, but I'm having trouble figuring out how to do this
> in Stata.

If you fix the values of your covariates at a given value, you
can for each year predict the probabilities that a treaty is
rattified in that year given that it is not rattified before
that. Say we have three years and we call those conditional
probabilities pr1 pr2 pr3, then the probability that it takes
one year to ratify is pr1, for two years it is (1-pr1)*p2, for
three years it is (1-pr1)*(1-pr2)*pr3. So the average number of
years it takes to rattify is:

pr1*1 + (1-pr1)*pr2*2 + (1-pr1)*(1-pr2)*pr3*3

If I were to do that with -logit- I would estimate my model,
create a new dataset that contains one "country" that is
observed for all years and has the characteristics at which
I want to fix those. I would than use -predict- to get the
conditional probabilities. After that I would manipulate those
according to the formula above. It is possible to automate that
but that is not worth the effort if you are only going to do
that once or twice.

Alternatively, you could use -seqlogit- for that (see:
-ssc d seqlogit-). You would need to be a bit careful, as you
are than modeling the probability of _not_ ratifying at each
year, but it has a predict function that will allow you to
predict the average number of years directly.

Notice that in order to compute this average all countries need
to have ratified the treaty at the moment you stopped measuring
(i.e. no right censoring), otherwise the number of years
represented by the final category is not 3 but some unknown
number of years larger than 3. The median is identified when
you have right censoring, you have the probabilities for each
year the running sum is the cumulative distribution, the year
where that running sum passes 50% is the median. -seqlogit-
does not have a prediction function for that.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

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