Announcement

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

  • snapspan - right-censored data

    Dear all,

    currently I am converting my snapshot dataset to time-span dataset with the command snapspan.

    My datastructure is like that:
    id event_date event time-varying_variable continuous_variable
    1 01.01.2015 1 . 5
    1 15.02.2015 2 100 5
    1 30.03.2015 2 200 5
    The data is right-censored due to end of observation. Event 1 is just the entry/origin of that individual. The event in this case is not a failure event. The event 2 will only cause a change in the time-varying variable.

    After using snapsan my data looks like:

    id date0 event_date event time-varying_variable continuous_variable
    1 . 01.01.2015 1 . 5
    1 01.01.2015 15.02.2015 2 . 5
    1 15.02.2015 30.03.2015 2 100 5
    The problem is now that after the second event (on 30.03.2015), Stata is loosing the information about the time-varying variable. In this case it will loose the increase of the time-varying variable of 100 to 200. This change lasts until the end of observation since there is no failure at id 1.

    Am I right that this loss is not important, since e.g. cox model would only consider the time-varying variable in the case of a failure? In the case of a failure (event = 3) there would be another line like that:
    id date0 event_date event time-varying_variable continuous_variable
    1 . 01.01.2015 1 . 5
    1 01.01.2015 15.02.2015 2 . 5
    1 15.02.2015 30.03.2015 2 100 5
    1 30.03.2015 15.04.2015 3 200 5
    Thanks, Max

  • #2
    You didn't get an immediate response to your question. Please read the FAQ on asking questions. With data formatted in dataex, we can more easily deal with your issues. It would probably be helpful to have data on two ids as well.

    I don't use snapsan or cox models so I can't really help you here.


    Comment


    • #3
      Thank you Phil for your comment. I am very much appreciating forum rules in order to make Q&A as efficient as possible. I think the shown tables are focusing on the main problem, and therefore, they should be easy to unterstand for a survival expert.

      Comment


      • #4
        Max, I urge you to read the FAQ, especially #12, about how to show data. The tables you show in #1 are fine for human eyes. But I can tell you that a person with sufficient expertise to answer your question quickly will have to waste a lot of time wrestling those tables into Stata, much more time than it will take for them to code a solution to your problem. You need to be considerate of those who would help you. You should put the effort into making your data readily available in a convenient form. That is why -dataex- was created. You should install it (-ssc install dataex-) and use it all the time to post data examples. You should not expect responders to deal with decoding HTML tables for you.

        Comment


        • #5
          Okay, sorry to all of you. I made now a simple extract of my data. Hope this is okay and easier to read for you. Sorry again for the inconvenience.


          This is the dataset:

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input byte id int event_date byte event str3 timevarying_variable byte continuous_variable
          1 20089 1 "."   5
          1 20134 2 "100" 5
          1 20177 2 "200" 5
          2 20026 1 "."   3
          2 20046 2 "150" 3
          2 19724 2 "250" 3
          2 20072 3 "250" 3
          3 20381 1 "."   4
          3 20417 2 "300" 4
          3 20452 4 "300" 4
          3 20468 3 "300" 4
          end
          format %tdnn/dd/CCYY event_date

          And here I am using snapspan to convert the snapshot data to time-span data (including the stset command)

          Code:
          snapspan id event_date event, gen(date0) replace
          stset event_date, id(id) time0(date0) origin(time date0) failure(event==3 4) exit(event==3 time td(30Aug2016))
          Failure event: 3 and 4
          Exit: at event 3 or by the end of observation on 30. August 2016

          The result is the following:

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input byte id int event_date byte event str3 timevarying_variable byte continuous_variable int date0 byte(_st _d) int(_origin _t _t0)
          1 20089 1 ""    .     . 0 . 20089   .   .
          1 20134 2 "."   5 20089 1 0 20089  45   0
          1 20177 2 "100" 5 20134 1 0 20089  88  45
          2 19724 2 ""    .     . 0 . 19724   .   .
          2 20026 1 "250" 3 19724 1 0 19724 302   0
          2 20046 2 "."   3 20026 1 0 19724 322 302
          2 20072 3 "150" 3 20046 1 1 19724 348 322
          3 20381 1 ""    .     . 0 . 20381   .   .
          3 20417 2 "."   4 20381 1 0 20381  36   0
          3 20452 4 "300" 4 20417 1 1 20381  71  36
          3 20468 3 "300" 4 20452 1 1 20381  87  71
          end
          format %tdnn/dd/CCYY event_date
          format %tdnn/dd/CCYY date0
          The problem is now that after the second event of individual 1 (on 30.03.2015), Stata is loosing the information about the time-varying variable. In this case it will loose the increase of the time-varying variable of 100 to 200. This change lasts until the end of observation since there is no failure at id 1.

          Am I right that this loss is not important, since e.g. cox model would only consider the time-varying variable in the case of a failure? In the case of a failure and exit (event = 3) there would be another line like at individual 2.

          Thanks, Max

          Comment

          Working...
          X