Announcement

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

  • Landmark Survival Analysis - STS Graph not accounting for landmark time of entry

    Hello Statalist Community,

    I am performing a landmark survival analysis to investigate whether the addition of chemotherapy to surgery for older patients (age>=80) with pancreatic cancer is associated with improved overall survival. My dependent variable, overall survival, was calculated as time from 90 days after diagnosis until death or last known follow-up, I used this landmark time point of 90 days from diagnosis until death or last know follow-up and excluded patients who died within 90 days of diagnosis to account for immortal time bias. My exposure was receipt of chemotherapy after surgery.

    I have two variables that define follow up time (months):
    1. Real follow-up time (t=postopfu) *
    2. landmarked time (postopfu90=t-3 mo)
    I tried to use the origin and entry options on stset so that I don’t have to redefine my follow up time to account for the landmark entry (Approach A vs. Approach B in code below), and so I can plot the survival curves with real follow up time. But the issue I am having is that the survival curves I have generated already show separation of the survival curves at the landmark point of entry when I graph them, where as when I redefine my follow up time in option A the curves start together as you would expect. Is there something I missing in my code with the way sts graph pulls data to graph - it appears the origin and entry terms do not apply when graphing sts? Is there a way around this?

    Code:
    ** Follow up time**
    summarize postopfu, detail
    generate postopfu90 = postopfu - 3
    summarize postopfu90, detail
    ** A: Overall survival - landmark time accounted for **
    stset postopfu90, failure(laststatus==1)
    stci
    by anychemo: stci, median
    sts test anychemo, logrank
    stset postopfu90, failure(laststatus==1)
    sts graph, by(anychemo) tmin(3) tmax(60) xtitle(Time (months)) xlabel(0 12 24 36 48 60) risktable(, size(3) order(1 "No Chemotherapy" 2 "Chemotherapy")) legend(label(1 "No Chemotherapy") label (2 "Chemotherapy") title(, size(1))) title("") xline(3, lcolor(blue) lpattern(dash))
    
    ** B: Overall survival - real follow up time **
    stset postopfu, failure(laststatus==1) enter(time 3) origin(time 3)
    stci
    by anychemo: stci, median
    sts test anychemo, logrank
    sts graph, by(anychemo) tmin(3) tmax(60) xtitle(Time (months)) xlabel(0 12 24 36 48 60) risktable(, size(3) order(1 "No Chemotherapy" 2 "Chemotherapy")) legend(label(1 "No Chemotherapy") label (2 "Chemotherapy") title(, size(1))) title("") xline(3, lcolor(blue) lpattern(dash))
    Graph A:




    Graph B:



  • #2
    Can you show the output?

    Comment


    • #3
      Code:
      . summarize postopfu, detail 
      
                                postopfu
      -------------------------------------------------------------
            Percentiles      Smallest
       1%         3.52           3.12
       5%         4.53           3.12
      10%         5.75           3.12       Obs               1,968
      25%          9.3           3.22       Sum of Wgt.       1,968
      
      50%         17.1                      Mean           24.06058
                              Largest       Std. Dev.      21.48896
      75%       31.375         132.37
      90%        51.52         135.69       Variance       461.7753
      95%        66.99          139.1       Skewness       2.024202
      99%       109.73         142.23       Kurtosis       8.090972
      
      . generate postopfu90 = postopfu - 3
      
      . summarize postopfu90, detail 
      
                               postopfu90
      -------------------------------------------------------------
            Percentiles      Smallest
       1%          .52       .1199999
       5%         1.53       .1199999
      10%         2.75       .1199999       Obs               1,968
      25%          6.3            .22       Sum of Wgt.       1,968
      
      50%         14.1                      Mean           21.06058
                              Largest       Std. Dev.      21.48896
      75%       28.375         129.37
      90%        48.52         132.69       Variance       461.7753
      95%        63.99          136.1       Skewness       2.024202
      99%       106.73         139.23       Kurtosis       8.090972
      
      . 
      . ** Overall survival - landmark time accounted for **
      . stset postopfu90, failure(laststatus==1) 
      
           failure event:  laststatus == 1
      obs. time interval:  (0, postopfu90]
       exit on or before:  failure
      
      ------------------------------------------------------------------------------
            1,968  total observations
                0  exclusions
      ------------------------------------------------------------------------------
            1,968  observations remaining, representing
            1,655  failures in single-record/single-failure data
        41,447.22  total analysis time at risk and under observation
                                                      at risk from t =         0
                                           earliest observed entry t =         0
                                                last observed exit t =    139.23
      
      . stci
      
               failure _d:  laststatus == 1
         analysis time _t:  postopfu90
      
                   | Number of 
                   |  subjects         50%      Std. Err.    [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             Total |      1968       14.87      .4628914        13.72       15.6
      
      . by anychemo: stci, median
      
      -------------------------------------------------------------------------------------------------------------------------------
      -> anychemo = 0
      
               failure _d:  laststatus == 1
         analysis time _t:  postopfu90
      
                   | Number of 
                   |  subjects         50%      Std. Err.    [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             Total |      1097        12.7      .6159029        11.69      14.02
      
      -------------------------------------------------------------------------------------------------------------------------------
      -> anychemo = 1
      
               failure _d:  laststatus == 1
         analysis time _t:  postopfu90
      
                   | Number of 
                   |  subjects         50%      Std. Err.    [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             Total |       871       16.48      .7465297        15.43      18.45
      
      . 
      . ** KS Curve - landmark time accounted for **
      . sts test anychemo, logrank 
      
               failure _d:  laststatus == 1
         analysis time _t:  postopfu90
      
      
      Log-rank test for equality of survivor functions
      
               |   Events         Events
      anychemo |  observed       expected
      ---------+-------------------------
      0        |       937         844.06
      1        |       718         810.94
      ---------+-------------------------
      Total    |      1655        1655.00
      
                     chi2(1) =      20.94
                     Pr>chi2 =     0.0000
      
      . sts graph, by(anychemo) tmin(0) tmax(60) xtitle(Time (months)) xlabel(0 12 24 36 48 60) risktable(, size(3) order(1 "No Chemo
      > therapy" 2 "Chemotherapy")) legend(label(1 "No Chemotherapy") label (2 "Chemotherapy") title(, size(1))) title("") xline(0, l
      > color(blue) lpattern(dash)) 
      
               failure _d:  laststatus == 1
         analysis time _t:  postopfu90
      
      . 
      end of do-file
      
      . drop _st _d _t _t0
      
      . do "/var/folders/k6/6scj6cy11w95g95zr82lg6p00000gp/T//SD64501.000000"
      
      . ** Overall survival - real follow up time **
      . stset postopfu, failure(laststatus==1) enter(time 3) origin(time 3)
      
           failure event:  laststatus == 1
      obs. time interval:  (origin, postopfu]
       enter on or after:  time 3
       exit on or before:  failure
          t for analysis:  (time-origin)
                  origin:  time 3
      
      ------------------------------------------------------------------------------
            1,968  total observations
                0  exclusions
      ------------------------------------------------------------------------------
            1,968  observations remaining, representing
            1,655  failures in single-record/single-failure data
        41,447.22  total analysis time at risk and under observation
                                                      at risk from t =         0
                                           earliest observed entry t =         0
                                                last observed exit t =    139.23
      
      . stci
      
               failure _d:  laststatus == 1
         analysis time _t:  (postopfu-origin)
                   origin:  time 3
        enter on or after:  time 3
      
                   | Number of 
                   |  subjects         50%      Std. Err.    [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             Total |      1968       14.87      .4628914        13.72       15.6
      
      . by anychemo: stci, median
      
      ----------------------------------------------------------------------------------------------------------------
      -> anychemo = 0
      
               failure _d:  laststatus == 1
         analysis time _t:  (postopfu-origin)
                   origin:  time 3
        enter on or after:  time 3
      
                   | Number of 
                   |  subjects         50%      Std. Err.    [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             Total |      1097        12.7      .6159029        11.69      14.02
      
      ----------------------------------------------------------------------------------------------------------------
      -> anychemo = 1
      
               failure _d:  laststatus == 1
         analysis time _t:  (postopfu-origin)
                   origin:  time 3
        enter on or after:  time 3
      
                   | Number of 
                   |  subjects         50%      Std. Err.    [95% Conf. Interval]
      -------------+-------------------------------------------------------------
             Total |       871       16.48      .7465297        15.43      18.45
      
      . 
      . ** KS Curve - real follow up time **
      . sts test anychemo, logrank 
      
               failure _d:  laststatus == 1
         analysis time _t:  (postopfu-origin)
                   origin:  time 3
        enter on or after:  time 3
      
      
      Log-rank test for equality of survivor functions
      
               |   Events         Events
      anychemo |  observed       expected
      ---------+-------------------------
      0        |       937         844.06
      1        |       718         810.94
      ---------+-------------------------
      Total    |      1655        1655.00
      
                     chi2(1) =      20.94
                     Pr>chi2 =     0.0000
      
      . sts graph, by(anychemo) tmin(3) tmax(60) xtitle(Time (months)) xlabel(0 12 24 36 48 60) risktable(, size(3) or
      > der(1 "No Chemotherapy" 2 "Chemotherapy")) legend(label(1 "No Chemotherapy") label (2 "Chemotherapy") title(, 
      > size(1))) title("") xline(3, lcolor(blue) lpattern(dash)) 
      
               failure _d:  laststatus == 1
         analysis time _t:  (postopfu-origin)
                   origin:  time 3
        enter on or after:  time 3
      
      . graph save "/Users/winta/Documents/Research /Wang/NCDB/KS_landmark_overall_cohort_2021", replace  
      (file /Users/winta/Documents/Research /Wang/NCDB/KS_landmark_overall_cohort_2021.gph saved)

      Comment


      • #4
        It appears to me as the two analytic approaches give identical results, as they should. I can't see the two graphs in your original post. I tried to reproduce the problem (see code below) but couldn't (the two graphs A and B are identical).

        Can you provide us with some data, or reproduce the problem using the brcancer data?

        An obersvation: In #1 you have tmin(3) and xline(3) in both graphs. In #3 you have tmin(0) and xline(0) in one graph but tmin(3) and xline(3) in the other. Therefore, you should get different graphs in #3 since you have specified different graphs. I don't know your research question, but it's not obvious why you would want to use tmin(3) and xline(3) given how you have set up the data.

        Code:
        webuse brcancer, clear
        generate rectime300=rectime-300
        
        // A:
        stset rectime300, f(censrec==1)
        sts graph, by(hormon) tmin(300) tmax(2700) risktable xlabel(0(300)2700) ///
                   xline(300, lcolor(blue) lpattern(dash)) name(A, replace)
                   
        // B:
        stset rectime, f(censrec==1) enter(time 300) origin(time 300)
        sts graph, by(hormon) tmin(300) tmax(2700) risktable xlabel(0(300)2700) ///
                   xline(300, lcolor(blue) lpattern(dash)) name(B, replace)

        Comment

        Working...
        X