Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • stset with multiple failure per subject data

    Hi everyone,

    I would like to ask for some advice on stset-ing my dataset with multiple failures per subject.

    The event is 'admission to hospital'. So each subject can be admitted again after they are discharged.

    I have set up my data as recommended by the Cleves tutorial for conditional risk set modelling (3.2.4) but when I stset, it only recognises the first line per id' & I get an output for 'single-failure-per-subject-data', with blank cells for the subsequent rows.

    . stset end, fail(admit) enter(start) exit(end) id(id)

    id: id
    failure event: admit != 0 & admit < .
    obs. time interval: (end[_n-1], end]
    enter on or after: time start
    exit on or before: time end

    ------------------------------------------------------------------------------
    298 total observations
    5 observations end on or before enter()
    63 observations begin on or after exit
    ------------------------------------------------------------------------------
    230 observations remaining, representing
    230 subjects
    31 failures in single-failure-per-subject data
    188,425 total analysis time at risk and under observation
    at risk from t = 0
    earliest observed entry t = 20,698
    last observed exit t = 21,792


    Any help much appreciated.

    thanks,

    Tommy.

  • #2
    Providing a data example with dataex (as suggested in the FAQ) would be useful. You can make up the data if privacy is a concern.

    You may need to specify exit(end .) instead of exit(end)

    Comment


    • #3
      Dear Paul,

      exit(end .) instead does not seem to work. Here are the first ten study participants as per dataex (I have removed the other variables as they are sensitive information). 'ID' is participant ID number, start is 'study' entry time, 'end' is study exit time, 'admit' represents an event and 'time' is analysis time.

      Would be incredibly grateful for any suggestions. Thanks!

      input int id float(start end) byte admit float time
      1 20774 21187 1 413
      1 21188 21792 0 604
      2 20742 21792 0 1050
      3 20781 21792 0 1011
      4 21134 21792 0 658
      5 21236 21792 0 556
      6 20854 21304 1 450
      6 21308 21792 0 484
      7 21068 21792 0 724
      8 20713 21792 0 1079
      9 20837 21792 0 955
      10 20836 21383 1 547
      10 21384 21699 1 315
      10 21705 21792 0 87



      Comment


      • #4
        Copying CODE lines from dataex

        . dataex id start end admit time, varlabel

        ----------------------- copy starting from the next line -----------------------
        [CODE]
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input int id float(start end) byte admit float time
        1 20774 21187 1 413
        1 21188 21792 0 604
        2 20742 21792 0 1050
        3 20781 21792 0 1011
        4 21134 21792 0 658
        5 21236 21792 0 556
        6 20854 21304 1 450
        6 21308 21792 0 484
        7 21068 21792 0 724
        8 20713 21792 0 1079
        9 20837 21792 0 955
        10 20836 21383 1 547
        10 21384 21699 1 315
        10 21705 21792 0 87

        Comment


        • #5
          Sorry. It's exit(time .).

          Following is come code that I hope will take you closer to the solution, but there are some issues I can't resolve.

          There are two variations of the conditional risk set model; one where time is measured from study entry and one where time is measured from the previous event (i.e., the clock is set to zero after each failure). This code is for when time is measured from study entry. If you want to use the clock-reset variant then use your time variable rather than start/end times.

          The result of this -stset- doesn't exactly mirror your data. For ID=10, for example, you can see that there was an event at time=21699 and you have the next observation starting at time=21705. The result of -stset-, however, is for that observation to start at time=21699. I don't know how to resolve that, maybe someone with more insight into multiple-failure data can provide additional help.

          Code:
          . input int id float(start end) byte admit float time
          
                     id      start        end     admit       time
            1. 1 20774 21187 1 413
            2. 1 21188 21792 0 604
            3. 2 20742 21792 0 1050
            4. 3 20781 21792 0 1011
            5. 4 21134 21792 0 658
            6. 5 21236 21792 0 556
            7. 6 20854 21304 1 450
            8. 6 21308 21792 0 484
            9. 7 21068 21792 0 724
           10. 8 20713 21792 0 1079
           11. 9 20837 21792 0 955
           12. 10 20836 21383 1 547
           13. 10 21384 21699 1 315
           14. 10 21705 21792 0 87
           15. end
          
          . 
          . stset end, fail(admit) enter(start) exit(time .) id(id)
          
                          id:  id
               failure event:  admit != 0 & admit < .
          obs. time interval:  (end[_n-1], end]
           enter on or after:  time start
           exit on or before:  time .
          
          ------------------------------------------------------------------------------
                   14  total observations
                    0  exclusions
          ------------------------------------------------------------------------------
                   14  observations remaining, representing
                   10  subjects
                    4  failures in multiple-failure-per-subject data
                8,945  total analysis time at risk and under observation
                                                          at risk from t =         0
                                               earliest observed entry t =    20,713
                                                    last observed exit t =    21,792
          
          . 
          . list id start end admit _t0 _t _d _st
          
               +-------------------------------------------------------+
               | id   start     end   admit     _t0      _t   _d   _st |
               |-------------------------------------------------------|
            1. |  1   20774   21187       1   20774   21187    1     1 |
            2. |  1   21188   21792       0   21187   21792    0     1 |
            3. |  2   20742   21792       0   20742   21792    0     1 |
            4. |  3   20781   21792       0   20781   21792    0     1 |
            5. |  4   21134   21792       0   21134   21792    0     1 |
               |-------------------------------------------------------|
            6. |  5   21236   21792       0   21236   21792    0     1 |
            7. |  6   20854   21304       1   20854   21304    1     1 |
            8. |  6   21308   21792       0   21304   21792    0     1 |
            9. |  7   21068   21792       0   21068   21792    0     1 |
           10. |  8   20713   21792       0   20713   21792    0     1 |
               |-------------------------------------------------------|
           11. |  9   20837   21792       0   20837   21792    0     1 |
           12. | 10   20836   21383       1   20836   21383    1     1 |
           13. | 10   21384   21699       1   21383   21699    1     1 |
           14. | 10   21705   21792       0   21699   21792    0     1 |
               +-------------------------------------------------------+

          Comment


          • #6
            This is brilliant Paul. Very helpful.

            The reason the end dates are like that is because each event is an admission to hospital. Then while the patient is in hospital, they are not at risk of a further event until they are discharged. So the clock shouldn't really reset until the date of discharge. I will scratch my head and ask around. Thanks again!

            T

            Comment


            • #7
              Dear Statalist members,
              I had post a question on proportionality assumption for multiple failures on this link (Statalist). It is, in short if the proportionality assumption should hold true for multiple failure data and if the Stata commands (such as stphtest) can be used with robust variance-covariance matrix (multiple failure) to check proportionality assumption.
              thank you for your guidance

              Comment

              Working...
              X