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

st: data for streg


From   "Peter J. Burke" <[email protected]>
To   "statalist" <[email protected]>
Subject   st: data for streg
Date   Wed, 16 Feb 2005 09:40:08 -0800

Dear Users:
 
I am estimating a hazard model with data like the following wherein a person
(id)
can experience multiple "failures" but only when they are at risk. A person
does not become at risk immediately after experiencing a failure but only
after entering a particular state. The time a person becomes at risk is
indicated by the variable orig==1. The time of failure is given by fail==1.
I have used stset as follows
 
stset turns, failure(fail==1) exit(time .) id(id) origin(orig==1)
 
but this does not produce the appropriate dataset for analysis because
it assumes a person (id) becomes at risk at the first orig==1 and
then immediately after every failure. How can I create a dataset
that recognizes each time a person becomes at risk in a multiple risk
situation?
 
. list id turns sex crdnat tskid topic orig fail, separator(0)
 
      +-------------------------------------------------------------+
      |   id  time      tskid  tpc orig fail _st _d _origin  _t _t0 |
      |-------------------------------------------------------------|
   1. | 1101     1   .3436329    1    0    0   0  .      27   .   . |
   2. | 1101     6   .3436329    1    0    1   0  .      27   .   . |
   3. | 1101    27   .3436329    1    1    2   0  .      27   .   . |
   4. | 1101    35   .3436329    1    0    1   1  1      27   8   0 |
   5. | 1101    37   .3436329    1    1    2   1  0      27  10   8 |
   6. | 1101    61   .3436329    2    0    1   1  1      27  34  10 |
   7. | 1101    70   .3436329    2    1    2   1  0      27  43  34 |
   8. | 1101    87   .3436329    2    0    1   1  1      27  60  43 |
   9. | 1101    97   .3436329    2    1    2   1  0      27  70  60 |
  10. | 1101   119   .3436329    3    0    1   1  1      27  92  70 |
...
  33. | 1102    78  -1.340984    2    1    2   1  0       6  72  68 |
  34. | 1102    86  -1.340984    2    0    1   1  1       6  80  72 |
  35. | 1102    87  -1.340984    2    1    2   1  0       6  81  80 |
  36. | 1102    97  -1.340984    2    0    1   1  1       6  91  81 |
  37. | 1102   105  -1.340984    3    1    2   1  0       6  99  91 |
  38. | 1102   117  -1.340984    3    0    1   1  1       6 111  99 |
  39. | 1102   119  -1.340984    3    1    2   1  0       6 113 111 |
  40. | 1102   147  -1.340984    3    0    1   1  1       6 141 113 |
  41. | 1102   154  -1.340984    3    1    2   1  0       6 148 141 |
  42. | 1102   160  -1.340984    4    0    1   1  1       6 154 148 |
  43. | 1102   162  -1.340984    4    1    2   1  0       6 156 154 |
  44. | 1102   170  -1.340984    4    0    1   1  1       6 164 156 |

Peter


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