Announcement

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

  • In sts list, can we somehow test the difference in survival at a specific time point?

    Lets say i have incidence data of outcome A, and i want to see how incidence of A varies by levels of a variable X. I want to see this difference at 3 years. After Stsetting, I run this code:

    Code:
    sts list, at(0,3) by (X) failure
    For each level of variable X (lets say there are 3), i get for timepoints 0 and 3, the failure function, std error and 95% CI. Is there any way i can compare the confidence intervals of Xlevel3 to Xlevel1 by deriving a p value, for this 3 year time point?

  • #2
    Sakshi:
    you may want to consider something along the following lines:
    Code:
    . use https://www.stata-press.com/data/r18/stan3
    (Heart transplant data)
    
    . sts test posttran
    
            Failure _d: died
      Analysis time _t: t1
           ID variable: id
    
    Equality of survivor functions
    Log-rank test
    
             |  Observed       Expected
    posttran |    events         events
    ---------+-------------------------
           0 |        30          31.20
           1 |        45          43.80
    ---------+-------------------------
       Total |        75          75.00
    
                       chi2(1) =   0.13
                       Pr>chi2 = 0.7225
                      
    . sts test posttran if year==68
    
            Failure _d: died
      Analysis time _t: t1
           ID variable: id
    
    Equality of survivor functions
    Log-rank test
    
             |  Observed       Expected
    posttran |    events         events
    ---------+-------------------------
           0 |         9           7.95
           1 |         9          10.05
    ---------+-------------------------
       Total |        18          18.00
    
                       chi2(1) =   0.57
                       Pr>chi2 = 0.4517
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlos- this was a great idea- what worked well for me was to say time<=3 years (until 3 years not at) because i think thats how sts list computes it too- cumulatively. The way i wrote it in my question was confusing, sorry about that! However this works well only for 2 level variables..for a 3 level variable do you have any ideas? i.e, if I want to compare level 3 to level 1- that pairwise comparison.. Is there a way to manually calculate it ourselves from the confidence intervals of the survival estimates of the two levels that we get from sts list?

      Comment


      • #4
        Sakshi:
        hopefully, what follows is an answer to the first part of your question (I do not know if -margins- is the way to go for the second part):
        Code:
        . use "C:\Program Files\Stata18\ado\base\a\auto.dta"
        (1978 automobile data)
        
        . stset mpg, failure(foreign==1)
        
        Survival-time data settings
        
                 Failure event: foreign==1
        Observed time interval: (0, mpg]
             Exit on or before: failure
        
        --------------------------------------------------------------------------
                 74  total observations
                  0  exclusions
        --------------------------------------------------------------------------
                 74  observations remaining, representing
                 22  failures in single-record/single-failure data
              1,576  total analysis time at risk and under observation
                                                        At risk from t =         0
                                             Earliest observed entry t =         0
                                                  Last observed exit t =        41
        
        . sts test foreign, strata(rep78) detail
        note: 2 strata omitted because of no failures.
        
                Failure _d: foreign==1
          Analysis time _t: mpg
        
        Equality of survivor functions
        Stratified log-rank test
        Strata: rep78
        
        -> rep78 = 1
        
        (no test possible because there are no failures)
        
        -> rep78 = 2
        
        (no test possible because there are no failures)
        
        -> rep78 = 3
        
                 |  Observed       Expected
        foreign  |    events         events
        ---------+-------------------------
        Domestic |         0           1.97
         Foreign |         3           1.03
        ---------+-------------------------
           Total |         3           3.00
        
                           chi2(1) =   5.75
                           Pr>chi2 = 0.0165
        
        -> rep78 = 4
        
                 |  Observed       Expected
        foreign  |    events         events
        ---------+-------------------------
        Domestic |         0           1.45
         Foreign |         9           7.55
        ---------+-------------------------
           Total |         9           9.00
        
                           chi2(1) =   2.20
                           Pr>chi2 = 0.1383
        
        -> rep78 = 5
        
                 |  Observed       Expected
        foreign  |    events         events
        ---------+-------------------------
        Domestic |         0           1.29
         Foreign |         9           7.71
        ---------+-------------------------
           Total |         9           9.00
        
                           chi2(1) =   1.79
                           Pr>chi2 = 0.1807
        
        -> Total
        
                 |  Observed       Expected
        foreign  |    events         events*
        ---------+-------------------------
        Domestic |         0           4.71
         Foreign |        21          16.29
        ---------+-------------------------
           Total |        21          21.00
        
        * aggregated over stratum-specific results
        
                           chi2(1) =   8.66
                           Pr>chi2 = 0.0033
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Unfortunately Stata doesn't have such methods built-in, but it's not too hard to get there. What you are looking for can be done with the work described below. There are more papers for this method by this group, but the principal ones are the first two. The latter two are focused on showing applications in SAS, R and Stata. And since they transform this method into one that can be posed in the GLM framework, it is straightforward to compare more than 2 groups.

          A main disadvantage of the method suggested by Carlo is that it does not answer the question you have posed. It is instead comparing only a subset for the equality of median failure time (this is what a log-rank test does). It is distinctly not a comparison of survival proportion at a fixed point in time.

          Klein JP, Andersen PK. Regression modeling of competing risks data based on pseudovalues of the cumulative incidence function. Biometrics. 2005 Mar;61(1):223-9. doi: 10.1111/j.0006-341X.2005.031209.x. PMID: 15737097.

          Klein JP, Logan B, Harhoff M, Andersen PK. Analyzing survival curves at a fixed point in time. Stat Med. 2007 Oct 30;26(24):4505-19. doi: 10.1002/sim.2864. PMID: 17348080.

          Klein JP, Gerster M, Andersen PK, Tarima S, Perme MP. SAS and R functions to compute pseudo-values for censored data regression. Comput Methods Programs Biomed. 2008 Mar;89(3):289-300. doi: 10.1016/j.cmpb.2007.11.017. Epub 2008 Jan 15. PMID: 18199521; PMCID: PMC2533132.

          Overgaard, M., Andersen, P. K., & Parner, E. T. (2015). Regression Analysis of Censored Data Using Pseudo-observations: An Update. The Stata Journal, 15(3), 809-821. https://doi.org/10.1177/1536867X1501500313

          Comment

          Working...
          X