UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Textbook Examples
Applied Survival Analysis by Hosmer, Lemeshow and May
Chapter 3: Regression Models for Survival Data


Table 3.1 on page 78 using the actg320 dataset.
use http://www.ats.ucla.edu/stat/examples/asa2/actg320, clear

stset time, fail(censor)
stcox tx, nohr

         failure _d:  censor
   analysis time _t:  time

Iteration 0:   log likelihood = -658.46549
Iteration 1:   log likelihood = -653.12286
Iteration 2:   log likelihood = -653.11789
Iteration 3:   log likelihood = -653.11789
Refining estimates:
Iteration 0:   log likelihood = -653.11789

Cox regression -- Breslow method for ties

No. of subjects =         1151                     Number of obs   =      1151
No. of failures =           96
Time at risk    =       264941
                                                   LR chi2(1)      =     10.70
Log likelihood  =   -653.11789                     Prob > chi2     =    0.0011

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          tx |  -.6843186   .2149187    -3.18   0.001    -1.105551   -.2630857
------------------------------------------------------------------------------


Table 3.2 on page 83 continuing to use the actg320 dataset.
stcox tx age sex cd4 priorzdv, nohr

         failure _d:  censor
   analysis time _t:  time

Iteration 0:   log likelihood = -658.46549
Iteration 1:   log likelihood = -622.46228
Iteration 2:   log likelihood = -618.94567
Iteration 3:   log likelihood = -618.82581
Iteration 4:   log likelihood =  -618.8256
Refining estimates:
Iteration 0:   log likelihood =  -618.8256

Cox regression -- Breslow method for ties

No. of subjects =         1151                     Number of obs   =      1151
No. of failures =           96
Time at risk    =       264941
                                                   LR chi2(5)      =     79.28
Log likelihood  =    -618.8256                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          tx |  -.6589906   .2152889    -3.06   0.002    -1.080949   -.2370322
         age |   .0283562   .0112658     2.52   0.012     .0062756    .0504368
         sex |   .0972738   .2841181     0.34   0.732    -.4595874     .654135
         cd4 |  -.0165767   .0025453    -6.51   0.000    -.0215654   -.0115879
    priorzdv |  -.0002931   .0036913    -0.08   0.937     -.007528    .0069417
------------------------------------------------------------------------------


Table 3.3 on page 84 continuing to use the actg320 dataset.
stcox tx age cd4, nohr

         failure _d:  censor
   analysis time _t:  time

Iteration 0:   log likelihood = -658.46549
Iteration 1:   log likelihood = -622.50294
Iteration 2:   log likelihood = -619.00548
Iteration 3:   log likelihood =  -618.8856
Iteration 4:   log likelihood = -618.88539
Refining estimates:
Iteration 0:   log likelihood = -618.88539

Cox regression -- Breslow method for ties

No. of subjects =         1151                     Number of obs   =      1151
No. of failures =           96
Time at risk    =       264941
                                                   LR chi2(3)      =     79.16
Log likelihood  =   -618.88539                     Prob > chi2     =    0.0000

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          tx |  -.6587076   .2150446    -3.06   0.002    -1.080187    -.237228
         age |   .0277729   .0111474     2.49   0.013     .0059243    .0496215
         cd4 |  -.0165606   .0025391    -6.52   0.000    -.0215372    -.011584
------------------------------------------------------------------------------


Table 3.4 on page 87 using the whas100 dataset. We convert time to quarterly to increase the number of ties.
use http://www.ats.ucla.edu/stat/examples/asa2/whas100, clear

generate time=foltime/30.44 	/* divide by days per month */
replace time=round(time/3) 	/* divide by months per quarter */
replace time=.5 if time==0 	/* event can't occur at time zero */

stset time, fail(folstatus)

/* exact ties */
stcox bmi gender, nohr exactp 

         failure _d:  folstatus
   analysis time _t:  time

Iteration 0:   log likelihood = -183.56906
Iteration 1:   log likelihood = -177.82554
Iteration 2:   log likelihood = -177.79731
Iteration 3:   log likelihood = -177.79731
Refining estimates:
Iteration 0:   log likelihood = -177.79731

Cox regression -- exact partial likelihood

No. of subjects =          100                     Number of obs   =       100
No. of failures =           51
Time at risk    =         1648
                                                   LR chi2(2)      =     11.54
Log likelihood  =   -177.79731                     Prob > chi2     =    0.0031

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         bmi |  -.0921293   .0337883    -2.73   0.006    -.1583532   -.0259055
      gender |   .5391896   .2875519     1.88   0.061    -.0244017    1.102781
------------------------------------------------------------------------------

/* Breslow ties */
stcox bmi gender, nohr

         failure _d:  folstatus
   analysis time _t:  time

Iteration 0:   log likelihood = -210.71578
Iteration 1:   log likelihood =  -205.1773
Iteration 2:   log likelihood = -205.14533
Iteration 3:   log likelihood = -205.14533
Refining estimates:
Iteration 0:   log likelihood = -205.14533

Cox regression -- Breslow method for ties

No. of subjects =          100                     Number of obs   =       100
No. of failures =           51
Time at risk    =         1648
                                                   LR chi2(2)      =     11.14
Log likelihood  =   -205.14533                     Prob > chi2     =    0.0038

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         bmi |  -.0885065   .0329861    -2.68   0.007    -.1531582   -.0238549
      gender |   .5181654   .2830296     1.83   0.067    -.0365625    1.072893
------------------------------------------------------------------------------

/* Efron ties */
stcox bmi gender, nohr efron

         failure _d:  folstatus
   analysis time _t:  time

Iteration 0:   log likelihood = -210.06393
Iteration 1:   log likelihood = -204.20163
Iteration 2:   log likelihood = -204.16685
Iteration 3:   log likelihood = -204.16685
Refining estimates:
Iteration 0:   log likelihood = -204.16685

Cox regression -- Efron method for ties

No. of subjects =          100                     Number of obs   =       100
No. of failures =           51
Time at risk    =         1648
                                                   LR chi2(2)      =     11.79
Log likelihood  =   -204.16685                     Prob > chi2     =    0.0027

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         bmi |  -.0925082   .0334316    -2.77   0.006    -.1580329   -.0269835
      gender |   .5332732    .282779     1.89   0.059    -.0209634     1.08751
------------------------------------------------------------------------------

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.