Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: stset


From   [email protected] (Roberto G. Gutierrez, StataCorp.)
To   [email protected]
Subject   Re: st: stset
Date   Thu, 09 Jan 2003 10:23:19 -0600

Mar�a Elena Casquel del Campo <[email protected]> asks:

> I�m trying to estimate duration models with Stata. The problem is that I
> have multispell data in the sense that some individuals experiment failures
> but later enter another time in the sample. I�d like that when the
> individual enters after experimenting failure the clock starts clicking
> another time.

> I have introduced:
>  stset finish, failure(cens) time0(star) exit(time .) id(pid) origin(star)

>            pid       wave         _t0          _t        _d
> 120. 130911101          1           0          11         1
> 121. 130911101          2          12          23         0
> 122. 130911101          3          24          35         0
> 123. 151701103          1           0          11         1
> 124. 151701103          2          12          23         0
> 125. 151701103          3          24          35         0
> 126. 151701103          4          36          47         0
> 127. 151701103          5          48          59         0
> 128. 213341102          1           0          11         1
> 129. 213341102          2          12          23         0
> 130. 213341102          3          24          35         1

> I would like that _t0 start in 0 for the individual 130911101, observation
> 121.

There is some discussion of how to do this in [R] stsum.  Try, 

   . stgen nf = nfailures()
   . egen newpid = group(pid nf)
   . sort newpid finish
   . by newpid: gen newstar = star - star[1]
   . stset finish, failure(cens) id(newpid) time0(newstar) 

Also note: If you plan on fitting any regression to these models, be sure to
specify -cluster(pid)- since one would usually not consider the multiple
failures of each subject as independent events.

--Bobby
[email protected]
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index