Announcement

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

  • survival analysis - creating progression/failure variable and associated days since initial event

    I am new to statalist and have read through the rules as well as several related posts, but know I will probably do something wrong, so all constructive feedback is welcome! Thanks in advance.

    Hello, I would like to generate a progression variable and the associated progression/failure date in a survival analysis for bladder cancer.

    Below are several key variables for generating recurrence:
    • grade (levels 1,2)
    • tstage (levels 1 through 6)
    • radcx_reas – reason for cystectomy (levels 1-6)
    • mstage (levels 1,2,3)
    • ut – upper tract recurrence (levels 0,1)
    I have my data in long form, where each variable has an event of 1-10, and patients can have anywhere between 2 to 10 events/surgeries. Progression is defined as outcome relative to event 1 (initial diagnosis). Each event is associated with a "days" variable which is the number of days since event 1.

    Below are the failure criteria:

    Variable name: grade, levels 1, 2:
    - grade = 1 and event = 1 AND grade = 2 and event = 2 through 10.
    - Written out long ways: grade = 1 and event = 1 AND grade = 2 and event = 2 or grade = 2 and event = 3

    Variable name: tstage, levels 1, 2,3,4,5,6 (for PUNLMP, Tis, Ta, T1, T2, T3+ respectively):
    - tstage=2 and event=1 AND tstage= 4,5, or 6 and event = 2 through 10
    - tstage=3 and event=1 AND tstage= 4,5, or 6 and event = 2 through 10
    - tstage=4 and event=1 AND tstage= 5 or 6 and event = 2 through 10

    Variable name: radcx_reas, levels 1-6
    - radcx_reas==1-6 at events 2 through 10

    Variable name: mstage, levels 1,2,3
    - mstage=2 and event 2-10

    Variable name: ut, levels 0, 1
    -ut=1 and event 2-10

    I then need to generate the earliest failure date for each patient (record_id) using the “days” variable associated with that event.

    I tried to reference this post but have hard time understanding how to emulate the code as I am still a stata amateur.

    Thank you in advance. Happy to clarify any points.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int record_id byte event int days byte(grade tstage radcx_reas mstage ut)
     1 1    0 2 3 1 1 .
     1 2 3535 2 3 1 1 0
     1 3 4242 2 3 1 1 0
     1 4 4596 2 5 1 1 0
     2 1    0 2 3 . 1 0
     2 2  364 2 3 . 1 0
     3 1    0 2 3 . 1 0
     3 2 1604 . . . . .
     4 1    0 2 3 . 1 0
     5 1    0 2 3 . 1 .
     5 2  185 2 3 . 1 .
     5 3  322 2 3 . 1 .
     5 4  485 2 3 . 1 0
     5 5  602 2 3 . 1 .
     6 1    0 1 3 . 1 0
     6 2 1178 2 3 . 1 .
     6 3 1549 2 3 . 1 .
     6 4 2085 . . . . .
     6 5 2380 2 3 . 1 0
     6 6 2739 2 3 . 1 .
     6 7 2841 . . . . .
     7 1    0 1 3 . 1 .
     7 2  999 2 3 . 1 .
     7 3 1553 2 3 . 1 0
     7 4 2014 2 3 . 1 0
     7 5 2156 1 3 . 1 .
     8 1    0 2 3 . 1 0
     8 2 1769 2 4 . 1 0
     8 3 2746 2 3 . 1 0
     8 4 2805 1 2 . 1 .
     8 5 3023 . . . . .
     9 1    0 2 4 . 1 0
    10 1    0 1 3 . 1 .
    11 1    0 2 3 . 1 0
    11 3  206 1 3 . 1 0
    11 4 1883 2 3 . 1 .
    12 1    0 2 3 . 1 0
    13 1    0 2 4 . 1 0
    13 2  686 2 2 . 1 .
    15 1    0 2 3 . 1 0
    15 3  239 . . . . .
    15 4  827 . . . . 0
    17 1    0 2 4 . 1 .
    17 2 2044 2 4 . 1 1
    17 3 2169 2 3 . 1 .
    18 1    0 1 4 . 1 0
    18 2   58 2 3 . 1 .
    21 1    0 2 4 . 1 0
    21 2  202 2 . . 1 .
    21 3 1530 1 3 . 1 0
    22 1    0 2 2 2 1 .
    22 2  568 2 3 2 1 .
    22 3  703 2 4 2 3 .
    23 1    0 2 3 . 1 .
    23 2   49 1 3 . 1 0
    23 3  168 2 3 . 1 .
    23 4  714 . . . . 0
    27 1    0 2 3 . 1 .
    27 3  172 1 . . 1 .
    27 4  439 1 3 . 1 0
    27 5 1797 . . . . .
    29 1    0 2 4 . 3 .
    29 2  139 2 4 . 1 .
    29 3  183 . . . . .
    29 4  351 2 3 . 3 .
    29 5  443 2 3 . 1 0
    29 6  499 . . . 3 0
    29 7  524 . . . . .
    29 8  818 . . . . 0
    30 1    0 2 2 . 1 0
    30 2  168 2 4 . 1 0
    30 3  205 1 2 . 1 .
    30 4 1129 2 5 . 2 .
    31 1    0 . 2 . 1 0
    31 2  677 2 6 . 1 0
    36 1    0 2 3 2 1 0
    36 2  637 2 4 2 1 0
    37 1    0 2 3 . 1 0
    37 2  718 2 3 . 1 .
    37 3 1030 2 3 . 1 .
    38 1    0 2 3 . 1 .
    38 2 1235 1 3 . 1 0
    38 3 1483 2 4 . 1 0
    38 4 1586 2 4 . 1 .
    38 5 1768 2 3 . 1 .
    38 6 2131 2 4 . 1 .
    39 1    0 2 3 . 1 .
    39 2 4998 . . . . .
    39 3 4784 . . . . .
    39 4 5016 2 3 . 1 0
    39 5 5060 2 4 . 1 .
    40 1    0 2 3 . 1 0
    40 3  176 2 4 . 1 .
    42 1    0 1 3 . 1 .
    42 2 1354 . 2 . 1 0
    42 3 1916 . 2 . 1 .
    42 4 2285 . . . 3 .
    44 1    0 1 3 . 1 .
    44 2 1121 2 3 . 1 .
    45 1    0 2 3 . 1 0
    end
    label values grade grade1_v2_v10_92650b_
    label def grade1_v2_v10_92650b_ 1 "LG", modify
    label def grade1_v2_v10_92650b_ 2 "HG", modify
    label values tstage stage1_v2_v10_504c29_
    label def stage1_v2_v10_504c29_ 2 "cTis", modify
    label def stage1_v2_v10_504c29_ 3 "cTa", modify
    label def stage1_v2_v10_504c29_ 4 "cT1", modify
    label def stage1_v2_v10_504c29_ 5 "cT2", modify
    label def stage1_v2_v10_504c29_ 6 "cT3 or higher", modify
    label values radcx_reas radcx_reas_
    label def radcx_reas_ 1 "Progression after intravesical therapy", modify
    label def radcx_reas_ 2 "Persistence/Recurrence after intravesical therapy", modify
    label values mstage metastases_v2_v10_90cc44_
    label def metastases_v2_v10_90cc44_ 1 "M0", modify
    label def metastases_v2_v10_90cc44_ 2 "M1", modify
    label def metastases_v2_v10_90cc44_ 3 "MX", modify
    label values ut ut_dx_v2_v10_d8ec7f_
    label def ut_dx_v2_v10_d8ec7f_ 0 "No", modify
    label def ut_dx_v2_v10_d8ec7f_ 1 "Yes", modify

  • #2
    I may not have gotten every detail right, but I think this will at least point the way:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int record_id byte event int days byte(grade tstage radcx_reas mstage ut)
     1 1    0 2 3 1 1 .
     1 2 3535 2 3 1 1 0
     1 3 4242 2 3 1 1 0
     1 4 4596 2 5 1 1 0
     2 1    0 2 3 . 1 0
     2 2  364 2 3 . 1 0
     3 1    0 2 3 . 1 0
     3 2 1604 . . . . .
     4 1    0 2 3 . 1 0
     5 1    0 2 3 . 1 .
     5 2  185 2 3 . 1 .
     5 3  322 2 3 . 1 .
     5 4  485 2 3 . 1 0
     5 5  602 2 3 . 1 .
     6 1    0 1 3 . 1 0
     6 2 1178 2 3 . 1 .
     6 3 1549 2 3 . 1 .
     6 4 2085 . . . . .
     6 5 2380 2 3 . 1 0
     6 6 2739 2 3 . 1 .
     6 7 2841 . . . . .
     7 1    0 1 3 . 1 .
     7 2  999 2 3 . 1 .
     7 3 1553 2 3 . 1 0
     7 4 2014 2 3 . 1 0
     7 5 2156 1 3 . 1 .
     8 1    0 2 3 . 1 0
     8 2 1769 2 4 . 1 0
     8 3 2746 2 3 . 1 0
     8 4 2805 1 2 . 1 .
     8 5 3023 . . . . .
     9 1    0 2 4 . 1 0
    10 1    0 1 3 . 1 .
    11 1    0 2 3 . 1 0
    11 3  206 1 3 . 1 0
    11 4 1883 2 3 . 1 .
    12 1    0 2 3 . 1 0
    13 1    0 2 4 . 1 0
    13 2  686 2 2 . 1 .
    15 1    0 2 3 . 1 0
    15 3  239 . . . . .
    15 4  827 . . . . 0
    17 1    0 2 4 . 1 .
    17 2 2044 2 4 . 1 1
    17 3 2169 2 3 . 1 .
    18 1    0 1 4 . 1 0
    18 2   58 2 3 . 1 .
    21 1    0 2 4 . 1 0
    21 2  202 2 . . 1 .
    21 3 1530 1 3 . 1 0
    22 1    0 2 2 2 1 .
    22 2  568 2 3 2 1 .
    22 3  703 2 4 2 3 .
    23 1    0 2 3 . 1 .
    23 2   49 1 3 . 1 0
    23 3  168 2 3 . 1 .
    23 4  714 . . . . 0
    27 1    0 2 3 . 1 .
    27 3  172 1 . . 1 .
    27 4  439 1 3 . 1 0
    27 5 1797 . . . . .
    29 1    0 2 4 . 3 .
    29 2  139 2 4 . 1 .
    29 3  183 . . . . .
    29 4  351 2 3 . 3 .
    29 5  443 2 3 . 1 0
    29 6  499 . . . 3 0
    29 7  524 . . . . .
    29 8  818 . . . . 0
    30 1    0 2 2 . 1 0
    30 2  168 2 4 . 1 0
    30 3  205 1 2 . 1 .
    30 4 1129 2 5 . 2 .
    31 1    0 . 2 . 1 0
    31 2  677 2 6 . 1 0
    36 1    0 2 3 2 1 0
    36 2  637 2 4 2 1 0
    37 1    0 2 3 . 1 0
    37 2  718 2 3 . 1 .
    37 3 1030 2 3 . 1 .
    38 1    0 2 3 . 1 .
    38 2 1235 1 3 . 1 0
    38 3 1483 2 4 . 1 0
    38 4 1586 2 4 . 1 .
    38 5 1768 2 3 . 1 .
    38 6 2131 2 4 . 1 .
    39 1    0 2 3 . 1 .
    39 2 4998 . . . . .
    39 3 4784 . . . . .
    39 4 5016 2 3 . 1 0
    39 5 5060 2 4 . 1 .
    40 1    0 2 3 . 1 0
    40 3  176 2 4 . 1 .
    42 1    0 1 3 . 1 .
    42 2 1354 . 2 . 1 0
    42 3 1916 . 2 . 1 .
    42 4 2285 . . . 3 .
    44 1    0 1 3 . 1 .
    44 2 1121 2 3 . 1 .
    45 1    0 2 3 . 1 0
    end
    label values grade grade1_v2_v10_92650b_
    label def grade1_v2_v10_92650b_ 1 "LG", modify
    label def grade1_v2_v10_92650b_ 2 "HG", modify
    label values tstage stage1_v2_v10_504c29_
    label def stage1_v2_v10_504c29_ 2 "cTis", modify
    label def stage1_v2_v10_504c29_ 3 "cTa", modify
    label def stage1_v2_v10_504c29_ 4 "cT1", modify
    label def stage1_v2_v10_504c29_ 5 "cT2", modify
    label def stage1_v2_v10_504c29_ 6 "cT3 or higher", modify
    label values radcx_reas radcx_reas_
    label def radcx_reas_ 1 "Progression after intravesical therapy", modify
    label def radcx_reas_ 2 "Persistence/Recurrence after intravesical therapy", modify
    label values mstage metastases_v2_v10_90cc44_
    label def metastases_v2_v10_90cc44_ 1 "M0", modify
    label def metastases_v2_v10_90cc44_ 2 "M1", modify
    label def metastases_v2_v10_90cc44_ 3 "MX", modify
    label values ut ut_dx_v2_v10_d8ec7f_
    label def ut_dx_v2_v10_d8ec7f_ 0 "No", modify
    label def ut_dx_v2_v10_d8ec7f_ 1 "Yes", modify
    
    by record_id (event), sort: assert event[1] == 1
    
    //  FAILURE BY GRADE
    by record_id (event): gen byte temp = cond(grade[1] == 1, grade == 2, 0)
    by record_id (event): egen byte grade_fail = max(temp)
    by record_id (event): egen grade_fail_days = min(cond(temp, days, .))
    
    //  FAILURE BY T-STAGE
    by record_id (event): replace temp = ( ///
            (inlist(tstage[1], 2, 3) & inlist(tstage, 4, 5, 6)) ///
            | (tstage[1] == 4 & inrange(tstage, 5, 6)) ///
        )
    by record_id (event): egen tstage_fail = max(temp)
    by record_id (event): egen tstage_fail_days = min(cond(temp, days, .))
     
    //  FAILURE BY RADICAL CYSTECTOMY
    by record_id (event): replace temp = ///
        (cond(event > 1, inrange(radcx_reas, 1, 6), 0))
    by record_id (event): egen radcx_fail = max(temp)
    by record_id (event): egen radcx_fail_days = min(cond(temp, days, .))
    
    //  FAILURE BY M-STAGE
    by record_id (event):  replace temp = cond(event > 1, mstage == 2, 0)
    by record_id (event): egen mstage_fail = max(temp)
    by record_id (event): egen mstage_fail_days = min(cond(temp, days, .))
    
    //  FAILURE BY UT
    by record_id (event): replace temp = cond(event > 1, ut == 1, 0)
    by record_id (event): egen ut_fail = max(temp)
    by record_id (event): egen ut_fail_days = min(cond(temp, days, .))
    
    drop temp
    
    //  PROGRESSION BY ANY CRITERION, AND TIME OF EARLIEST FAILURE
    egen byte progressed = rowmax(*_fail)
    egen byte when_progressed = rowmin(*_fail_days)
    Notes:

    1. For the most part event number increases as days increase within record_id. But for record_id 39 this is not true. Data error?

    2. I find it odd that some of the specific categories of progression refer only to being present at events 2-10, regardless of whether they were also present at event 1 or not. I've coded it that way, but wanted to confirm this is really what you meant.

    3. This will not be enough to enable you to proceed to a survival analysis. You will also need to calculate the number of days at risk under observation for those who never progressed. this will be their "failure" time in the -stset- command, although you will also indicate that when progressed == 0, they are censored. From the data set alone, I do not have enough information to do the calculation. It might be the date of the last event in the data set, or it might be some subsequent date at which the study ended, or the patient withdrew or died of unrelated causes, or observation terminated for some other reason. Presumably you have that information.

    Comment


    • #3
      Hi Clyde!! Thank you for your response. I am learning a lot by going through your code! I have a question about how you use the cond() function, which obviously works but I don't understand how despite looking it up in various documentations. I understand the basics of cond(x, a, b), but why does your function work when the second term has a "==" statement? Thanks in advance for considering my elementary question.

      To answer your concerns in notes:

      1) Wow, thank you for catching these data errors. I will go back to the original database and correct them before running the formal analysis (have not done so at time of this post).

      2) Yes that is correct and reflects the inclusion criteria for this dataset. For example, all patients are have mstage=0 or ut=0 to be included. Please correct me if that is not what you're asking.

      3) I haven't gotten to that step but thank you for looking ahead. There is a date of last follow-up variable, "dofu." This variable is in a date format so I will need to subtract date_turbt at event1 from it to generate the failure time as you pointed out. I would love to get your advice on doing that as well since I probably can only do that in a very clunky way. Data attached.

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input int record_id byte event int days byte(grade tstage radcx_reas mstage ut) float(date_turbt dofu)
       1 1    0 2 3 1 1 . 15501 20985
       1 2 3535 2 3 1 1 0 19036 20985
       1 3 4242 2 3 1 1 0 19743 20985
       1 4 4596 2 5 1 1 0 20097 20985
       2 1    0 2 3 . 1 0 18864 20234
       2 2  364 2 3 . 1 0 19228 20234
       3 1    0 2 3 . 1 0 19372 20977
       3 2 1604 . . . . . 20976 20977
       4 1    0 2 3 . 1 0 18707 19523
       5 1    0 2 3 . 1 . 18469 19212
       5 2  185 2 3 . 1 . 18654 19212
       5 3  322 2 3 . 1 . 18791 19212
       5 4  485 2 3 . 1 0 18954 19212
       5 5  602 2 3 . 1 . 19071 19212
       6 1    0 1 3 . 1 0 17462 20334
       6 2 1178 2 3 . 1 . 18640 20334
       6 3 1549 2 3 . 1 . 19011 20334
       6 4 2085 . . . . . 19547 20334
       6 5 2380 2 3 . 1 0 19842 20334
       6 6 2739 2 3 . 1 . 20201 20334
       6 7 2841 . . . . . 20303 20334
       7 1    0 1 3 . 1 . 17667 19823
       7 2  999 2 3 . 1 . 18666 19823
       7 3 1553 2 3 . 1 0 19220 19823
       7 4 2014 2 3 . 1 0 19681 19823
       7 5 2156 1 3 . 1 . 19823 19823
       8 1    0 2 3 . 1 0 16962 20570
       8 2 1769 2 4 . 1 0 18731 20570
       8 3 2746 2 3 . 1 0 19708 20570
       8 4 2805 1 2 . 1 . 19767 20570
       8 5 3023 . . . . . 19985 20570
       9 1    0 2 4 . 1 0 18786 19731
      10 1    0 1 3 . 1 . 18462 19852
      11 1    0 2 3 . 1 0 18728 20970
      11 3  206 1 3 . 1 0 18934 20970
      11 4 1883 2 3 . 1 . 20611 20970
      12 1    0 2 3 . 1 0 19176 19956
      13 1    0 2 4 . 1 0 19372 20948
      13 2  686 2 2 . 1 . 20058 20948
      15 1    0 2 3 . 1 0 18800 21012
      15 3  239 . . . . . 19039 21012
      15 4  827 . . . . 0 19627 21012
      17 1    0 2 4 . 1 . 16588 20321
      17 2 2044 2 4 . 1 1 18632 20321
      17 3 2169 2 3 . 1 . 18757 20321
      18 1    0 1 4 . 1 0 18582 20171
      18 2   58 2 3 . 1 . 18640 20171
      21 1    0 2 4 . 1 0 19046 20934
      21 2  202 2 . . 1 . 19248 20934
      21 3 1530 1 3 . 1 0 20576 20934
      22 1    0 2 2 2 1 . 19064 20544
      22 2  568 2 3 2 1 . 19632 20544
      22 3  703 2 4 2 3 . 19767 20544
      23 1    0 2 3 . 1 . 18861 19956
      23 2   49 1 3 . 1 0 18910 19956
      23 3  168 2 3 . 1 . 19029 19956
      23 4  714 . . . . 0 19575 19956
      27 1    0 2 3 . 1 . 18809 20786
      27 3  172 1 . . 1 . 18981 20786
      27 4  439 1 3 . 1 0 19248 20786
      27 5 1797 . . . . . 20606 20786
      29 1    0 2 4 . 3 . 18792 20557
      29 2  139 2 4 . 1 . 18931 20557
      29 3  183 . . . . . 18975 20557
      29 4  351 2 3 . 3 . 19143 20557
      29 5  443 2 3 . 1 0 19235 20557
      29 6  499 . . . 3 0 19291 20557
      29 7  524 . . . . . 19316 20557
      29 8  818 . . . . 0 19610 20557
      30 1    0 2 2 . 1 0 19107 20363
      30 2  168 2 4 . 1 0 19275 20363
      30 3  205 1 2 . 1 . 19312 20363
      30 4 1129 2 5 . 2 . 20236 20363
      31 1    0 . 2 . 1 0 19101 19803
      31 2  677 2 6 . 1 0 19778 19803
      36 1    0 2 3 2 1 0 18968 20688
      36 2  637 2 4 2 1 0 19605 20688
      37 1    0 2 3 . 1 0 19037 20851
      37 2  718 2 3 . 1 . 19755 20851
      37 3 1030 2 3 . 1 . 20067 20851
      38 1    0 2 3 . 1 . 17563 19712
      38 2 1235 1 3 . 1 0 18798 19712
      38 3 1483 2 4 . 1 0 19046 19712
      38 4 1586 2 4 . 1 . 19149 19712
      38 5 1768 2 3 . 1 . 19331 19712
      38 6 2131 2 4 . 1 . 19694 19712
      39 1    0 2 3 . 1 . 14035 20727
      39 2 4998 . . . . . 19033 20727
      39 3 4784 . . . . . 18819 20727
      39 4 5016 2 3 . 1 0 19051 20727
      39 5 5060 2 4 . 1 . 19095 20727
      40 1    0 2 3 . 1 0 19050 19801
      40 3  176 2 4 . 1 . 19226 19801
      42 1    0 1 3 . 1 . 17424 19780
      42 2 1354 . 2 . 1 0 18778 19780
      42 3 1916 . 2 . 1 . 19340 19780
      42 4 2285 . . . 3 . 19709 19780
      44 1    0 1 3 . 1 . 18414 20223
      44 2 1121 2 3 . 1 . 19535 20223
      45 1    0 2 3 . 1 0 19295 19711
      end
      format %dM_d,_CY date_turbt
      format %dM_d,_CY dofu
      label values grade grade1_v2_v10_92650b_
      label def grade1_v2_v10_92650b_ 1 "LG", modify
      label def grade1_v2_v10_92650b_ 2 "HG", modify
      label values tstage stage1_v2_v10_504c29_
      label def stage1_v2_v10_504c29_ 2 "cTis", modify
      label def stage1_v2_v10_504c29_ 3 "cTa", modify
      label def stage1_v2_v10_504c29_ 4 "cT1", modify
      label def stage1_v2_v10_504c29_ 5 "cT2", modify
      label def stage1_v2_v10_504c29_ 6 "cT3 or higher", modify
      label values radcx_reas radcx_reas_
      label def radcx_reas_ 1 "Progression after intravesical therapy", modify
      label def radcx_reas_ 2 "Persistence/Recurrence after intravesical therapy", modify
      label values mstage metastases_v2_v10_90cc44_
      label def metastases_v2_v10_90cc44_ 1 "M0", modify
      label def metastases_v2_v10_90cc44_ 2 "M1", modify
      label def metastases_v2_v10_90cc44_ 3 "MX", modify
      label values ut ut_dx_v2_v10_d8ec7f_
      label def ut_dx_v2_v10_d8ec7f_ 0 "No", modify
      label def ut_dx_v2_v10_d8ec7f_ 1 "Yes", modify

      Comment


      • #4
        I understand the basics of cond(x, a, b), but why does your function work when the second term has a "==" statement?
        Expressions like something == something_else (or substitute <, <=, >, >=, or != for ==) are logical (aka Boolean) expressions. In Stata, logical expressions are internally evaluated as numbers: 0 for false and 1 for true. (It works in reverse, too: you can place a numerical expression in places where a logical one would normally appear, and the numerical value will be interpreted by a similar, but slightly different rule--0 means false, and anything else, including missing value, is interpreted as true.) So, for example, Stata handles the expression -mstage == 2- looks at the value of grade in the first observation (of the by-group) to see whether that value is 2. If so, that expression evaluates as 1; if not, as 0. This usage is perfectly general in Stata: anywhere a numerical expression can go, a logical expression can appear and will be evaluated to 0 or 1 accordingly.

        Regarding 2), yes, that is what I was asking, and your explanation makes perfect sense.

        Regarding 3), you will want to do something like this:
        Code:
        by record_id (event), sort: gen length_of_follow_up = dofu - date_turbt[1]
        egen analysis_time = rowmin(when_progressed length_of_follow_up)
        Then when you -stset- your data for survival analysis, analysis_time will be the time variable and progressed will be the failure variable. So -stset analysis_time, failure(progressed)- is the basic version assuming you will be reducing your data to one observation per record_id.

        Comment


        • #5
          Thank you Clyde!! The code was great and I was able to perform the survival analysis, and your explanation regarding the cond() function makes sense.

          My next question is: what is considered good form regarding the help we receive on this forum when it comes to credit for a publication? For example, Clyde's code is helping me move my project to the next stage which I consider significant contribution. Is there expectation for acknowledgement or even authorship? Does a conversation regarding this happen ever? Obviously this is different from a typical academic collaboration and I realize every situation is different, but I want to see what people think since I'm new around here and I want to give credit where it's due. Thanks in advance for your thoughts. I also realize this is a different conversation than the original post so I'm happy to move it elsewhere.

          Comment


          • #6
            The kind of advice I have provided here would definitely not qualify me for co-authorship on the paper. If you wish to acknowledge technical assistance from me in your paper, the journal will require you obtain my consent to do so. You have my consent to do that, and I will confirm that to the journal if asked to. But I neither request nor expect any acknowledgment for this contribution. I give the advice I give here freely, because I enjoy it.

            I do, however, appreciate your asking about this. Over the course of my career, in other circumstances where I was more deeply involved, I have occasionally had my work appropriated by others without any mention of my role. That felt ugly. So when it is unclear, it is best to err on the side of having a discussion. So thank you for asking; I appreciate your comment to academic integrity.

            Comment

            Working...
            X