Announcement

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

  • sureg compare COX time-to-event regression comparison between 2 groups

    Hi, first post, my mentor told me to run 'sureg' to compare my estimates from two COX regressions split analysis by race (Black and White) in my panel data. How do i compare the estimates from those two equations? how do I compare across 4 racial groups--White Black Hispanic Other--given the same COX regression below? --Ginny Natale,PhD

    copy starting from the next line ------------ ------ ---
    copy starting from the next line --------- ------ ------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int idauniq byte wavey float depressed int agey float(female    istrc)    byte(drinkn    smoken    smokev    heart    bp    diab)    double    bmi
    3  0 1 60 0 0 1 0 0 1 0 0 28
    3  2 1 62 0 0 0 0 0 1 0 0 25
    3  4 0 64 0 0 1 0 0 1 0 0 26
    3  6 0 66 0 0 0 0 0 1 0 0 28
    3  8 0 68 0 0 0 0 0 1 0 0 26
    3 10 0 70 0 1 0 0 0 1 0 0 27
    3 12 0 72 0 1 1 0 0 1 0 0 24
    3 14 0 74 0 1 0 0 0 1 0 0 24
    3 16 0 76 0 1 0 0 0 1 0 0 22
    4  0 0 57 1 0 0 0 0 0 0 0 36
    4  2 0 59 1 0 1 0 0 0 0 0 29
    4  4 0 61 1 0 0 0 0 0 0 0 34
    4  6 0 63 1 0 0 0 0 0 0 0 29
    4  8 0 65 1 0 0 0 0 0 0 0 25
    4 10 0 67 1 1 0 0 0 0 0 0 24
    4 12 0 69 1 1 0 0 0 0 0 0 25
    4 15 0 72 1 1 0 0 0 0 0 0 25
    4 16 0 73 1 1 0 0 0 1 1 0 26
    4 18 0 75 1 1 0 0 0 1 1 0 23
    5  0 0 57 0 0 0 0 0 0 0 0 26
    5  1 1 58 0 0 0 0 0 0 0 0 23
    5  3 0 60 0 0 0 0 0 0 0 0 23
    5  5 0 62 0 0 0 0 0 0 0 0 24
    5  7 0 64 0 0 0 0 0 0 0 0 22
    5  9 0 66 0 0 0 0 0 0 0 0 21
    5 12 0 69 0 0 0 0 0 0 0 0 22
    5 14 0 71 0 0 0 0 0 0 0 0 21
    5 15 0 72 0 0 0 0 0 0 0 0 20
    5 17 0 74 0 0 0 0 0 0 0 0 20
    7 12 0 52 1 1 0 0 0 1 1 0 29
    7 14 0 54 1 1 0 0 0 1 1 0 34
    7 16 0 56 1 1 0 0 0 1 1 0 33
    7 18 0 58 1 1 0 0 0 1 1 0 35
    8  0 0 56 0 0 2 1 1 0 1 0 29
    8  2 1 58 0 0 3 0 1 0 1 0 29
    8  4 0 60 0 0 3 0 1 0 1 0 29
    8  6 1 62 0 0 3 0 1 0 1 0 30
    8  8 0 64 0 0 2 0 1 0 1 0 29
    8 10 0 66 0 0 2 0 1 0 1 0 29
    8 12 0 68 0 0 3 0 1 0 1 0 29
    8 14 1 70 0 0 2 0 1 0 1 0 29
    9  2 0 52 1 0 3 0 1 0 0 0 25
    9  4 0 54 1 0 4 0 1 0 0 0 25
    9  6 0 56 1 0 1 0 1 0 0 0 25
    9  8 0 58 1 0 3 0 1 0 0 0 26
    9 10 0 60 1 0 3 0 1 0 1 0 28
    9 11 0 61 1 0 3 0 1 0 1 0 27
    9 14 0 64 1 0 3 0 1 0 1 0 27
    9 16 0 66 1 0 2 0 1 0 1 0 27
    9 18 0 68 1 0 3 0 1 0 0 0 24
    10  0 1 58 0 0 0 1 1 1 1 0 27
    10  2 1 60 0 0 0 1 1 1 1 0 23
    10  4 1 62 0 0 0 1 1 1 1 0 30
    10  6 1 64 0 0 0 1 1 1 1 0 30
    10  7 1 65 0 0 0 1 1 1 1 1 26
    10 10 0 68 0 1 0 0 1 1 1 1 36
    10 12 1 70 0 1 0 0 1 1 1 1 33
    10 14 0 72 0 1 0 0 1 1 1 1 32
    10 16 0 74 0 1 0 0 1 1 1 1 27
    10 18 1 76 0 1 0 0 1 1 1 1 26
    11  4 0 52 1 0 0 1 1 0 0 0 23
    11  6 1 54 1 0 0 1 1 0 0 0 24
    11  8 1 56 1 0 1 1 1 0 0 0 24
    11 10 1 58 1 0 0 1 1 0 0 0 25
    11 12 0 60 1 0 1 1 1 0 0 0 24
    11 14 1 62 1 0 0 1 1 0 0 0 25
    11 16 0 64 1 0 0 1 1 0 0 0 25
    11 18 0 66 1 0 0 1 1 0 0 0 26
    12  0 0 59 0 0 1 0 0 0 1 0 24
    12  2 0 61 0 0 2 0 0 0 1 0 24
    12  4 0 63 0 0 2 0 0 0 1 0 24
    12  6 0 65 0 0 2 0 0 0 1 0 24
    12  8 0 67 0 0 1 0 0 1 1 0 24
    12 11 0 70 0 0 1 0 0 1 1 0 24
    12 12 0 71 0 0 1 0 0 1 1 0 23
    12 15 0 74 0 0 1 0 0 1 1 0 23
    12 17 0 76 0 0 1 0 0 1 1 0 23
    12 18 0 77 0 0 1 0 0 1 1 0 23
    13  0 0 53 1 0 1 0 1 0 0 0 21
    13  2 1 55 1 0 1 0 1 0 0 0 21
    13  4 0 57 1 0 1 0 1 0 0 0 22
    13  6 0 59 1 0 1 0 1 0 0 0 22
    13  8 0 61 1 0 2 0 1 0 0 0 21
    13 10 0 63 1 0 2 0 1 0 0 0 22
    13 12 0 65 1 0 1 0 1 0 0 0 22
    13 14 0 67 1 0 2 0 1 1 0 0 22
    13 16 0 69 1 0 2 0 1 1 0 0 23
    13 18 0 71 1 0 2 0 1 1 0 0 23
    14  0 0 55 1 0 0 0 0 0 1 0 25
    14  1 0 56 1 0 0 0 0 0 1 0 25
    14  4 0 59 1 0 0 0 0 0 1 0 25
    14  5 0 60 1 0 0 0 0 0 1 0 25
    14  8 0 63 1 1 0 0 0 0 1 0 25
    14  9 0 64 1 1 0 0 0 0 1 0 25
    14 11 0 66 1 1 0 0 0 0 1 0 25
    14 13 0 68 1 1 0 0 0 0 1 1 27
    14 16 0 71 1 1 0 0 0 0 1 1 25
    14 17 0 72 1 1 0 0 0 0 1 0 26
    15  0 0 61 1 0 2 1 1 0 0 0 20
    15  2 0 63 1 0 2 1 1 0 0 0 20
    end
    label values drinkn DRINKX
    label def DRINKX 0 "0.0 or doesnt drink", modify
    label values smoken YESNOS
    label def YESNOS 0 "0.no", modify
    label def YESNOS 1 "1.yes", modify
    label values smokev SMOKEV
    label def SMOKEV 0 "0.no", modify
    label def SMOKEV 1 "1.yes", modify
    label values diab RAWCOND
    label values heart RAWCOND
    label def RAWCOND 0 "0.no", modify
    label def RAWCOND 1 "1.yes", modify
    copy up to and including the previous line ---- ------ ------


    These are my COX regressions by the variable 'black'. Failure is an Alzheimer's diagnosis==1.

    Code:
    stset agey, id(idauniq) failure(iadrd==1) o(bagey)
    
    stcox  depressed agey female istrc drinkn smoken smokev heart bp diab bmi if black==0
    predict r_white, resid
    
    stcox depressed agey female istrc drinkn smoken smokev heart bp diabbmi if black==1 
    
    predict r_black, resid
    cor r_white r_black, cov
    Problem: option 'resid' not allowed

    ************************************************** ****************
    I also ran
    Code:
    sureg (onset depressed agey female istrc drinkn smoken smokev heart bp diab bmi if black==0) (onset depressed agey female istrc drinkn smoken smokev heart bp diab bmi if black==1) ,corr
    Returned this error
    Covariance matrix of errors is singular

    symmetric __00000A[2,2]
    __000006 __000007
    __000006 .06787132
    __000007 0 0

    r(506);

    end of do-file


  • #2
    Your data example is no good as it lacks some of the variables that you use in your codes, e.g., "idauniq" and "black". You can set up an interaction model as follows:

    Code:
    use https://www.stata-press.com/data/r17/drugtr2
    stset time, failure(cured)
    gen which =_n<=20
    
    *SEPARATE MODELS BY WHICH
    stcox age drug1 drug2 if !which, nolog
    stcox age drug1 drug2 if which, nolog
    
    *INTERACTION MODEL
    stcox i.which#(c.age c.drug1 c.drug2), strata(which) nolog
    Thereafter, compare the coefficients across models using the test command.

    Res.:

    Code:
    . stcox age drug1 drug2 if !which, nolog
    
             failure _d:  cured
       analysis time _t:  time
    
    Cox regression -- Breslow method for ties
    
    No. of subjects =           25                  Number of obs    =          25
    No. of failures =           21
    Time at risk    =   359.400002
                                                    LR chi2(3)       =       11.09
    Log likelihood  =   -49.482537                  Prob > chi2      =      0.0112
    
    ------------------------------------------------------------------------------
              _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .9009059   .0353086    -2.66   0.008     .8342936    .9728367
           drug1 |   1.002802   .0055168     0.51   0.611     .9920469    1.013673
           drug2 |      .9954    .006394    -0.72   0.473     .9829466    1.008011
    ------------------------------------------------------------------------------
    
    . 
    . stcox age drug1 drug2 if which, nolog
    
             failure _d:  cured
       analysis time _t:  time
    
    Cox regression -- Breslow method for ties
    
    No. of subjects =           20                  Number of obs    =          20
    No. of failures =           15
    Time at risk    =  318.5000014
                                                    LR chi2(3)       =       24.83
    Log likelihood  =   -25.263052                  Prob > chi2      =      0.0000
    
    ------------------------------------------------------------------------------
              _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .8256975   .0506571    -3.12   0.002     .7321485    .9311996
           drug1 |   1.030358   .0118288     2.61   0.009     1.007433    1.053805
           drug2 |   1.024429   .0119399     2.07   0.038     1.001292      1.0481
    ------------------------------------------------------------------------------
    
    . 
    . 
    . 
    . *INTERACTION MODEL
    
    . 
    . stcox i.which#(c.age c.drug1 c.drug2), strata(which) nolog
    
             failure _d:  cured
       analysis time _t:  time
    
    Stratified Cox regr. -- Breslow method for ties
    
    No. of subjects =           45                  Number of obs    =          45
    No. of failures =           36
    Time at risk    =  677.9000034
                                                    LR chi2(6)       =       35.92
    Log likelihood  =   -74.745589                  Prob > chi2      =      0.0000
    
    -------------------------------------------------------------------------------
               _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
      which#c.age |
               0  |   .9009059   .0353086    -2.66   0.008     .8342936    .9728367
               1  |   .8256975   .0506571    -3.12   0.002     .7321485    .9311996
                  |
    which#c.drug1 |
               0  |   1.002802   .0055168     0.51   0.611     .9920469    1.013673
               1  |   1.030358   .0118288     2.61   0.009     1.007433    1.053805
                  |
    which#c.drug2 |
               0  |      .9954    .006394    -0.72   0.473     .9829466    1.008011
               1  |   1.024429   .0119399     2.07   0.038     1.001292      1.0481
    -------------------------------------------------------------------------------
                                                              
    .

    Comment


    • #3
      Shouldn't the covariate effects be different in the interaction model compared to the split models?? and what about power in running those interactions for each covariate?

      test command? to compare what values? How does the test command compare HR's in the models? The chi-sq2 test?

      Im trying to use 'sureg' on a cox model to compare seemingly unrelated regressions by group. How do i compare the estimates from separate Cox models , not how to do an interaction model.

      Comment


      • #4
        Sorry, I cannot follow what you are saying. By

        compare my estimates from two COX regressions split analysis
        I interpret this as testing cross-model hypotheses, in which case, see

        Code:
        help test
        applied to the coefficients in the interaction model.

        Comment


        • #5
          sorry. To be more clear. How do i test the estimates significance of difference between 90/1) which#c.drug1 of
          Code:
          which#c.drug1|
          0 | 1.002802 .0055168 0.51 0.611 .9920469 1.013673
          1 | 1.030358 .0118288 2.61 0.009 1.007433 1.053805
          Do I store the estimates first then run test?

          Im only able to do
          Code:
           sts test drug1
          How do I stst test [HR=1.002802] to [HR 1.0305358] interaction of which#drug1 and which#drug2?

          Code:
          which#c.drug2 |
          0 | .9954 .006394 -0.72 0.473 .9829466 1.008011
          1 | 1.024429 .0119399 2.07 0.038 1.001292 1.0481

          Comment


          • #6
            Run the command with the -coeflegend- option to see how the coefficients are named.

            Code:
            use https://www.stata-press.com/data/r17/drugtr2
            stset time, failure(cured)
            gen which =_n<=20
            
            *INTERACTION MODEL
            stcox i.which#(c.age c.drug1 c.drug2), strata(which) nolog coeflegend
            test  _b[0b.which#c.drug1] =  _b[1.which#c.drug1]
            Res.:

            Code:
            . stcox i.which#(c.age c.drug1 c.drug2), strata(which) nolog coeflegend
            
                     failure _d:  cured
               analysis time _t:  time
            
            Stratified Cox regr. -- Breslow method for ties
            
            No. of subjects =           45                  Number of obs    =          45
            No. of failures =           36
            Time at risk    =  677.9000034
                                                            LR chi2(6)       =       35.92
            Log likelihood  =   -74.745589                  Prob > chi2      =      0.0000
            
            -------------------------------------------------------------------------------
                       _t |      Coef.  Legend
            --------------+----------------------------------------------------------------
              which#c.age |
                       0  |  -.1043545  _b[0b.which#c.age]
                       1  |  -.1915268  _b[1.which#c.age]
                          |
            which#c.drug1 |
                       0  |   .0027976  _b[0b.which#c.drug1]
                       1  |   .0299065  _b[1.which#c.drug1]
                          |
            which#c.drug2 |
                       0  |  -.0046106  _b[0b.which#c.drug2]
                       1  |   .0241352  _b[1.which#c.drug2]
            -------------------------------------------------------------------------------
                                                                       Stratified by which
            
            .
            . test  _b[0b.which#c.drug1] =  _b[1.which#c.drug1]
            
             ( 1)  0b.which#c.drug1 - 1.which#c.drug1 = 0
            
                       chi2(  1) =    4.53
                     Prob > chi2 =    0.0332
            
            .

            Comment

            Working...
            X