Announcement

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

  • Problem with bootstrapping stcrreg

    Dear Statalist,

    I am working on a survival model (long dataset format). The objective is to run a competing-risk regression for the composite outcome (variable 'comp =1 2 3 4 5'), with 'comp==9' as a competing risk.
    Variable 'event' represents the label for timepoints of 'date'.
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int no byte(age rdm) float date byte(event ptdm) float comp byte acr
    1 61 0 18272  1 0 0 .
    1 61 0 18303  2 0 0 .
    1 61 0 18394 18 1 0 .
    1 61 0 19845  7 1 0 0
    1 61 0 20137  8 1 0 0
    1 61 0 20223 15 1 0 0
    1 61 0 20420 19 1 2 0
    1 61 0 20487  9 1 2 0
    1 61 0 20489 16 1 2 0
    1 61 0 22462 23 1 2 0
    1 61 0 22691 24 1 2 0
    6 52 0 18324  1 0 0 .
    6 52 0 18343  2 0 0 .
    6 52 0 18508  3 0 0 .
    6 52 0 21208 11 0 0 0
    6 52 0 21572 12 0 0 0
    6 52 0 21943 13 0 0 0
    6 52 0 22262 23 0 0 0
    6 52 0 23142 24 0 0 0
    7 41 0 18336  1 0 0 .
    end
    format %td date
    label values event event
    label def event 1 "KT", modify
    label def event 2 "1mo", modify
    label def event 3 "6mo", modify
    label def event 7 "4y", modify
    label def event 8 "5y", modify
    label def event 9 "6y", modify
    label def event 11 "8y", modify
    I can run the final model as:
    Code:
     stset date , id( no ) failure( comp ==1/5) origin(event==1) scale(365.25)
    
    Survival-time data settings
    
               ID variable: no
             Failure event: comp==1 2 3 4 5
    Observed time interval: (date[_n-1], date]
         Exit on or before: failure
         Time for analysis: (time-origin)/365.25
                    Origin: event==1
    
    --------------------------------------------------------------------------
          7,328  total observations
            558  observations end on or before enter()
            296  observations begin on or after (first) failure
    --------------------------------------------------------------------------
          6,474  observations remaining, representing
            549  subjects
             55  failures in single-failure-per-subject data
      3,342.489  total analysis time at risk and under observation
                                                    At risk from t =         0
                                         Earliest observed entry t =         0
                                              Last observed exit t =  13.21287
    
    . stcrreg  age rdm ptdm acr  , compete(comp== 9)
    
            Failure _d: comp==1 2 3 4 5
      Analysis time _t: (date-origin)/365.25
                Origin: event==1
           ID variable: no
    
    Iteration 0:   log pseudolikelihood = -269.83536  
    Iteration 1:   log pseudolikelihood = -269.80709  
    Iteration 2:   log pseudolikelihood = -269.80708  
    
    Competing-risks regression                        No. of obs      =      5,923
                                                      No. of subjects =        541
    Failure events:  comp == 1 2 3 4 5                No. failed      =         54
    Competing event: comp == 9                        No. competing   =         17
                                                      No. censored    =        470
    
                                                      Wald chi2(4)    =     115.67
    Log pseudolikelihood = -269.80708                 Prob > chi2     =     0.0000
    
                                       (Std. err. adjusted for 541 clusters in no)
    ------------------------------------------------------------------------------
                 |               Robust
              _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   1.038975   .0125617     3.16   0.002     1.014644    1.063889
             rdm |   6.603938    2.20809     5.65   0.000     3.429222    12.71775
            ptdm |   2.388427   1.035484     2.01   0.045     1.021128    5.586551
             acr |   6.566593   2.450044     5.04   0.000     3.160463    13.64362
    ------------------------------------------------------------------------------
    However, when I ran the bootstrap command, it returned this:

    Code:
    bootstrap, noisily reps(10) seed(1): stcrreg  age rdm ptdm acr  , compete(com
    > p== 9)
    bootstrap: First call to stcrreg with data as is:
    
    . stcrreg age rdm ptdm acr, compete(comp== 9)
    
            Failure _d: comp==1 2 3 4 5
      Analysis time _t: (date-origin)/365.25
                Origin: event==1
           ID variable: no
    
    Iteration 0:   log pseudolikelihood = -269.83536  
    Iteration 1:   log pseudolikelihood = -269.80709  
    Iteration 2:   log pseudolikelihood = -269.80708  
    
    Competing-risks regression                        No. of obs      =      5,923
                                                      No. of subjects =        541
    Failure events:  comp == 1 2 3 4 5                No. failed      =         54
    Competing event: comp == 9                        No. competing   =         17
                                                      No. censored    =        470
    
                                                      Wald chi2(4)    =     115.67
    Log pseudolikelihood = -269.80708                 Prob > chi2     =     0.0000
    
                                       (Std. err. adjusted for 541 clusters in no)
    ------------------------------------------------------------------------------
                 |               Robust
              _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   1.038975   .0125617     3.16   0.002     1.014644    1.063889
             rdm |   6.603938    2.20809     5.65   0.000     3.429222    12.71775
            ptdm |   2.388427   1.035484     2.01   0.045     1.021128    5.586551
             acr |   6.566593   2.450044     5.04   0.000     3.160463    13.64362
    ------------------------------------------------------------------------------
    
    Bootstrap replications (10)
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    . stcrreg age rdm ptdm acr, compete(comp== 9) 
    data with multiple failures per subject not supported by stcrreg
    an error occurred when bootstrap executed stcrreg, posting missing values
    insufficient observations to compute bootstrap standard errors
    no results will be saved
    r(2000);
    I noticed that if I use stcox, the bootstrap worked fine:
    Code:
     bootstrap,  reps(10) seed(1): stcox  age rdm ptdm acr
    (running stcox on estimation sample)
    
    Bootstrap replications (10)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
    ..........
    
    Cox regression with Breslow method for ties
    
    Bootstrap results
    
    No. of subjects =        541                            Number of obs =  5,923
    No. of failures =         54
    Time at risk    = 3,178.0561
                                                            Wald chi2(4)  = 522.77
    Log likelihood = -267.79661                             Prob > chi2   = 0.0000
    
    ------------------------------------------------------------------------------
                 |   Observed   Bootstrap                         Normal-based
              _t | haz. ratio   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   1.041612   .0148074     2.87   0.004      1.01299    1.071042
             rdm |   6.674006   1.013341    12.50   0.000     4.956159    8.987272
            ptdm |   2.357624   .7253323     2.79   0.005     1.290027    4.308737
             acr |   6.452919   2.833782     4.25   0.000     2.728684    15.26016
    ------------------------------------------------------------------------------
    Do you have any ideas how to make bootstrapping work with stcrreg? Or did I miss any important options required in order to make boostrapping with stcrreg work?

    Thank you.

  • #2
    Even if your original data set contains only one failure per subject, when you do bootstrap resampling, you are sampling with replacement so it is possible, even likely, that some subjects will end up with more than one failure in the bootstrap samples. -stcrreg- does not accept data sets with multiple failure per person. -stcox- allows them, although the way your data was -stset-, -stcox- will only consider the first failure per subject.

    I think you can get around this by adding the -cluster(no)- and -idcluster(pick_a_name_for_a_new_variable)- options to your -bootstrap:- prefix. That will cause Stata to treat re-samplings of the same no's observation as if they were different people and should avoid the problem.

    Comment


    • #3
      Dear Clyde,

      Thank you so much for your suggestion.
      However, it still could not overcome the error we've got.

      Code:
      bootstrap, noisily cluster(no)  idcluster(newno) reps(10) seed(1): stcrreg  ag
      > e rdm ptdm acr abmr  ca a1c crcl, compete(comp== 9)
      bootstrap: First call to stcrreg with data as is:
      
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9)
      
              Failure _d: comp==1 2 3 4 5
        Analysis time _t: (date-origin)/365.25
                  Origin: event==1
             ID variable: no
      
      Iteration 0:   log pseudolikelihood = -198.67777  
      Iteration 1:   log pseudolikelihood = -198.65779  
      Iteration 2:   log pseudolikelihood = -198.65779  
      
      Competing-risks regression                        No. of obs      =      3,822
                                                        No. of subjects =        507
      Failure events:  comp == 1 2 3 4 5                No. failed      =         45
      Competing event: comp == 9                        No. competing   =         15
                                                        No. censored    =        447
      
                                                        Wald chi2(8)    =     137.13
      Log pseudolikelihood = -198.65779                 Prob > chi2     =     0.0000
      
                                         (Std. err. adjusted for 507 clusters in no)
      ------------------------------------------------------------------------------
                   |               Robust
                _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               age |   1.047996   .0157745     3.11   0.002      1.01753    1.079374
               rdm |   6.080825   2.332637     4.71   0.000     2.867061    12.89698
              ptdm |   2.697827    1.27997     2.09   0.036     1.064549    6.836949
               acr |   3.004378   1.375557     2.40   0.016     1.224704    7.370178
              abmr |   3.381073   1.885483     2.18   0.029     1.133379    10.08635
                ca |   .5943886   .1404099    -2.20   0.028      .374106    .9443789
               a1c |   1.155084   .0941302     1.77   0.077     .9845719    1.355126
              crcl |   .9782986   .0056848    -3.78   0.000     .9672199    .9895043
      ------------------------------------------------------------------------------
      
      Bootstrap replications (10)
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      . stcrreg age rdm ptdm acr abmr ca a1c crcl, compete(comp== 9) 
      data with multiple failures per subject not supported by stcrreg
      an error occurred when bootstrap executed stcrreg, posting missing values
      insufficient observations to compute bootstrap standard errors
      no results will be saved
      r(2000);

      Comment


      • #4
        I'm afraid I don't know what to tell you now. I thought that would solve the problem. Perhaps somebody else has some insight here.

        Comment

        Working...
        X