Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: stsplit creates missing risksets?


From   "Jacki Buros" <[email protected]>
To   [email protected]
Subject   st: stsplit creates missing risksets?
Date   Mon, 2 Apr 2007 17:26:42 -0400

Hello statlisters!

I have a question about the behavior of stsplit in the case of
multiple-failure-per-patient data, particularly in the definition of
"risk sets" where the riskset variable is set to be missing. I
understand from the help file that this will occur when there exists
an interval in which no patient experiences an event. I would like to
know why the riskset variable is set to missing in this case. Aren't
these patients considered "at risk", whether or not any one of them
has an event?

The context is a continuous-time survival analysis in which the data
is stset then stsplit twice before analyzed using gllamm with a
poisson link.

(The reason why the data is stsplit twice is because my dataset is
very large, and I have not the RAM to stsplit, at(failures) on the
complete dataset. I therefore stsplit once, in order to keep only the
first day of observations. Then stsplit, at(failures) to generate an
analysis dataset for that day -- which is fine since most effects are
time-variant).

But, I am concerned that the double-stsplit creates too many
observations with missing risksets, so that my poisson analysis will
be incorrect.

The following lines of stata code can be used to recreate the behavior:

--- begin Stata code: ---

  clear
  set mem 100m
  use http://www.stata-press.com/data/r8/mfail2.dta
  assert _st==1
  stsplit, at(failures) riskset(_rs)
  count if missing(_rs)                                         /*
419 with missing riskset */
  bysort id (_t): assert _N==_n if missing(_rs)   /* is TRUE */

  use http://www.stata-press.com/data/r8/mfail2.dta, clear
  assert _st==1
  stsplit time_5, at(10(0.5)40)
  assert ~missing(time_5)              /* no risksets are missing */
  keep if time_5<=20
  stsplit, at(failures) riskset(_rs)
  count if missing (_rs)                    /* 11782 obs have missing
riskset  */
  bysort id (_t): assert _N==_n if missing(_rs)   /* is FALSE */
  bysort id (_t): list id _t0 _t _d _rs

--- end Stata code ---

here is a snippet of the very last line of output:

-------------------------------------------------------------------------------------------------------------------------------------------------------------
-> id = 1

    +-----------------------------+
    | id    _t0     _t   _d   _rs |
    |-----------------------------|
 1. |  1      0      1    0     1 |
 2. |  1      1      2    0     2 |
 3. |  1      2      4    0     3 |
 4. |  1      4      6    0     4 |
 5. |  1      6      8    0     5 |
    |-----------------------------|
 6. |  1      8     10    0     6 |
 7. |  1     10   10.5    0     . |
 8. |  1   10.5     11    0     . |
 9. |  1     11   11.5    0     . |
10. |  1   11.5     12    0     7 |
    |-----------------------------|
11. |  1     12   12.5    0     . |
12. |  1   12.5     13    0     8 |
13. |  1     13   13.5    0     . |
14. |  1   13.5     14    0     9 |
15. |  1     14   14.5    0     . |
    |-----------------------------|
16. |  1   14.5     15    0    10 |
17. |  1     15   15.5    0     . |
18. |  1   15.5     16    0    11 |
19. |  1     16   16.5    0     . |
20. |  1   16.5     17    0    12 |
    |-----------------------------|
21. |  1     17   17.5    0     . |
22. |  1   17.5     18    0     . |
23. |  1     18   18.5    0     . |
24. |  1   18.5     19    0    13 |
25. |  1     19   19.5    0     . |

System is the following (stata-mp) on running on Linux

. version
version 9.2

. which stsplit
/usr/local/stata9/ado/base/s/stsplit.ado
*! version 2.2.4  15sep2004

. which stset
/usr/local/stata9/ado/base/s/stset.ado
*! version 6.0.2  15sep2004

I would very much appreciate any insight that one could offer!!

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