Announcement

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

  • Use of margins after stcox

    Hi all, I have a question about the interpretation of of the predicted relative hazard after the stcox command. Following is my code:
    Code:
    .  stcox i.pc2##c.satt  
    
             failure _d:  death == 1
       analysis time _t:  time
                 weight:  [pweight=wtssall]
    
    (sum of wgt is   2.1737e+04)
    Iteration 0:   log pseudolikelihood = -39195.681
    Iteration 1:   log pseudolikelihood =  -39130.37
    Iteration 2:   log pseudolikelihood = -39129.823
    Iteration 3:   log pseudolikelihood = -39129.823
    Refining estimates:
    Iteration 0:   log pseudolikelihood = -39129.823
    
    Cox regression -- Breslow method for ties
    
    No. of subjects      =  21737.34791                Number of obs   =     21610
    No. of failures      =  4159.189528
    Time at risk         =  295031.6937
                                                       Wald chi2(9)    =    117.64
    Log pseudolikelihood =   -39129.823                Prob > chi2     =    0.0000
    
    ------------------------------------------------------------------------------
                 |               Robust
              _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             pc2 |
              1  |   .8200554   .2761584    -0.59   0.556     .4238343    1.586683
              2  |   .5424295   .1835357    -1.81   0.071     .2794679    1.052822
              3  |   .4691222   .1710565    -2.08   0.038     .2295681     .958651
              4  |   .5458019   .1795656    -1.84   0.066     .2864144      1.0401
                 |
            satt |   1.039236   .0616714     0.65   0.517     .9251274     1.16742
                 |
      pc2#c.satt |
              1  |   1.005714   .0838742     0.07   0.946     .8540562    1.184303
              2  |   1.064622   .0891643     0.75   0.455      .903453    1.254542
              3  |   1.146117   .1044173     1.50   0.134     .9586936     1.37018
              4  |   1.035408   .0858124     0.42   0.675     .8801686    1.218028
    ------------------------------------------------------------------------------
    
     margins, at(satt=(2.3 5.8) pc2=(0(1)4))
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             _at |
              1  |   1.092554   .1491215     7.33   0.000     .8002816    1.384827
              2  |   1.250096   .4302696     2.91   0.004     .4067831    2.093409
              3  |   .9077743   .2383481     3.81   0.000     .4406206    1.374928
              4  |   1.059594   .2836983     3.73   0.000     .5035554    1.615632
              5  |   .6844408     .18012     3.80   0.000      .331412     1.03747
              6  |   .9750351   .2615896     3.73   0.000     .4623289    1.487741
              7  |    .701383   .1884264     3.72   0.000     .3320741    1.070692
              8  |    1.29347   .3594828     3.60   0.000     .5888966    1.998043
              9  |   .6460034   .1670661     3.87   0.000     .3185598     .973447
             10  |   .8348832   .2251931     3.71   0.000     .3935128    1.276254
    ------------------------------------------------------------------------------
     marginsplot, scheme(s1mono) noci
    The result of this code is this graph:
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	19.4 KB
ID:	1362534


    My question is what is the interpretation of the predicted relative hazards on the y-axis? I understand the interpretation of hazard ratios, however, the HRs in the output are based on a point of reference, whereas this graph has everything. Would interpretation then center around the relation between predictions at particular values? I.e. that the relative hazard predicted at pc2=0 is higher than that of pc2=1 by a factor of about 1.4 when satt=2.3. Am i looking at this correctly? Thank you for your assistance.

  • #2
    I'm having a hard time understanding a different aspect of your output.

    Your -margins- output should have begun with a table showing what combinations of satt and pc2 correspond to 1._at through 10._at, but it doesn't. Then, there is a complete disconnect between your graph and the -margins- output shown: the relative hazards in the graph range between a bit more than 1.5 and 3.5, but the -margins- output is between about 0.65 and 1.3--the ranges don't even overlap! I have never encountered that kind of situation in my work.

    So I think it would be premature to try to interpret any of this as something is quite wrong here, and it isn't at all clear to me what.

    I could tell you generically how to interpret the relative hazard ratios output by -margins-, but until we have a credible set of outputs to apply it to, I don't think it makes sense to go down that road.

    Comment


    • #3
      I apologize, I uploaded the wrong graph. I ran a simplified model for an example to post here. Also, I had omitted that table in the interests of parsimony. Here's updated with that section and the correct graph.
      Code:
      .  stcox i.pc2##c.satt  
      
               failure _d:  death == 1
         analysis time _t:  time
                   weight:  [pweight=wtssall]
      
      (sum of wgt is   2.1737e+04)
      Iteration 0:   log pseudolikelihood = -39195.681
      Iteration 1:   log pseudolikelihood =  -39130.37
      Iteration 2:   log pseudolikelihood = -39129.823
      Iteration 3:   log pseudolikelihood = -39129.823
      Refining estimates:
      Iteration 0:   log pseudolikelihood = -39129.823
      
      Cox regression -- Breslow method for ties
      
      No. of subjects      =  21737.34791                Number of obs   =     21610
      No. of failures      =  4159.189528
      Time at risk         =  295031.6937
                                                         Wald chi2(9)    =    117.64
      Log pseudolikelihood =   -39129.823                Prob > chi2     =    0.0000
      
      ------------------------------------------------------------------------------
                   |               Robust
                _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               pc2 |
                1  |   .8200554   .2761584    -0.59   0.556     .4238343    1.586683
                2  |   .5424295   .1835357    -1.81   0.071     .2794679    1.052822
                3  |   .4691222   .1710565    -2.08   0.038     .2295681     .958651
                4  |   .5458019   .1795656    -1.84   0.066     .2864144      1.0401
                   |
              satt |   1.039236   .0616714     0.65   0.517     .9251274     1.16742
                   |
        pc2#c.satt |
                1  |   1.005714   .0838742     0.07   0.946     .8540562    1.184303
                2  |   1.064622   .0891643     0.75   0.455      .903453    1.254542
                3  |   1.146117   .1044173     1.50   0.134     .9586936     1.37018
                4  |   1.035408   .0858124     0.42   0.675     .8801686    1.218028
      ------------------------------------------------------------------------------
      
      .
      
      
      
      
      . margins, at(satt=(2.3 5.8) pc2=(0(1)4))
      
      Adjusted predictions                              Number of obs   =      21610
      Model VCE    : Robust
      
      Expression   : Relative hazard, predict()
      
      1._at        : pc2             =           0
                     satt            =         2.3
      
      2._at        : pc2             =           0
                     satt            =         5.8
      
      3._at        : pc2             =           1
                     satt            =         2.3
      
      4._at        : pc2             =           1
                     satt            =         5.8
      
      5._at        : pc2             =           2
                     satt            =         2.3
      
      6._at        : pc2             =           2
                     satt            =         5.8
      
      7._at        : pc2             =           3
                     satt            =         2.3
      
      8._at        : pc2             =           3
                     satt            =         5.8
      
      9._at        : pc2             =           4
                     satt            =         2.3
      
      10._at       : pc2             =           4
                     satt            =         5.8
      
      ------------------------------------------------------------------------------
                   |            Delta-method
                   |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               _at |
                1  |   1.092554   .1491215     7.33   0.000     .8002816    1.384827
                2  |   1.250096   .4302696     2.91   0.004     .4067831    2.093409
                3  |   .9077743   .2383481     3.81   0.000     .4406206    1.374928
                4  |   1.059594   .2836983     3.73   0.000     .5035554    1.615632
                5  |   .6844408     .18012     3.80   0.000      .331412     1.03747
                6  |   .9750351   .2615896     3.73   0.000     .4623289    1.487741
                7  |    .701383   .1884264     3.72   0.000     .3320741    1.070692
                8  |    1.29347   .3594828     3.60   0.000     .5888966    1.998043
                9  |   .6460034   .1670661     3.87   0.000     .3185598     .973447
               10  |   .8348832   .2251931     3.71   0.000     .3935128    1.276254
      ------------------------------------------------------------------------------
      
      .
      end of do-file
      
      . marginsplot, scheme(s1mono) noci
      
        Variables that uniquely identify margins: satt pc2
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	18.0 KB
ID:	1362544

      Comment


      • #4
        OK, this makes sense.

        The hazard ratios calculated by -margins- and plotted by -marginsplot- are relative to the non-parametrically estimated hazard function where all of the predictors take on zero value. So in your case, it is always relative to the hazard corresponding to pc2 = 0 and satt = 0. Based on how you chose to run -margins-, it seems that 0 is not an interesting value of satt. I don't know what satt is; perhaps 0 is not even an ever-observed or theoretically possible value of satt. In any case, this suggests that you might want to re-do the Cox regression and all the other commands using a new variable created by centering satt around some more interesting value. That way the reference hazard for the relative hazards you get will be relative to something meaningful. If, however, 0 is a sensible value of satt to use as a reference case, then you have what you need this way.

        Comment


        • #5
          Great thank you. That makes a lot of sense. Satt is a psu-level variable based on the mean of an ordinal religious service attendance variable. There are no observed zeros, the 2.3 and 5.8 are the min/max, so I do need to change that variable so that it is more sensible. Again, thank you for your assistance.

          Comment

          Working...
          X