PEANUTS: Proportional Hazards (Cox) Regression Models

The purpose of  this analyses is to examine the effects of various factors on the survival of men in a heart transplantation program.  Models are fit to various subsets of the data, several different time scales are used.  Some of the models involve time-dependent covariates. The data is on 103 men in the Stanford Heart Transplant program.  These data were originally presented by Clark et al (Ann Intern Med 1971) and have been used extensively to illustrate Cox regression methods, including Crowley and Hu [JASA 1977], Kalbfleisch and Prentice [1980], and Aitkins et al [1983].  The main variables are the acceptance, transplant, and survival/censoring dates, age at acceptance, a heart surgery indicator, and a mismatch score.

Input commands are in blue.
Statements generated by PEANUTS are in green.

Define names for the free-format input data.  Then define a series of transformations to be carried out as the data are read.  These transformations illustrate some of the date manipulation capabilities available in all EPICURE programs.  The transformation defined by the CONS command defines a "named constant", i.e. a scalar variable.In this example the transformations are defined before the data are read.  They will be carried out as the data are read.
NAMES id bmo bdy byr accmo
    accdy accyr trmo trdy tryr xmo xdy xyr
       age surv surgery allele antigen  mismtch  reject  @
!Define date at program origin
   CONS #c1067 = JULIAN(1967,10,1) ;
              #c0167=julian(1967,1,1) @
TRAN ! Change years to 4 digits
    byr = byr + 1900 ;
   accyr = accyr + 1900 ;
   tryr = tryr + 1900 ;
   xyr = xyr + 1900 ;
! Compute age at acceptance, acceptance data and survival time
     cage = (JULIAN(accyr,accmo,accdy) - JULIAN(byr,bmo,bdy))/365.25 ;
     accdt = JULIAN(accyr,accmo,accdy) -1 ;
     stime = JULIAN(xyr,xmo,xdy) - accdt ;
 IF tryr == 1900 THEN
! Recodes for non-transplant patients
      allele = %mv ;          antigen = %mv ;          mismtch = %mv ;
      tryr = xyr ;  trmo = xmo ;  trdy = xdy ;
      trns = 0 ;
ELSE
! Recodes for transplant recipients
      trns = 1 ;
ENDIF@

The data are read and a number of additional transformations are carried out.
INPUT sheart.dat @
Input from sheart.dat
        103 records read        103 records used
           0 records rejected
Workspace for 300 variables.   33 are currently defined.
Up to 267 new variables can be created
! Compute exit date, waiting time, and post-transplant survival time
TRAN
     xtdt = JULIAN(tryr,trmo,trdy) ;
    wait = xtdt - accdt;
    post = stime - wait ;
! Special status code for pre-transplant analyses
 IF trns == 1
    THEN prestat = 0
ELSE
          prestat = surv
ENDIF
! Compute time since 10/1/67 at exit and since 1/1/67 at acceptance
      ctime = xtdt - #c1067 ;
     acc =  (accdt - #c0167)/365.25 ;
! Indicator for deselected subjects
     ds = (id == 26) or (id == 27) or (id == 82) ; @

Begin with models for  the transplant waiting time, i.e. time from acceptance to transplant.  Cases are those men who receive transplants.  The first model has no covariates and is used as a null model in a subsequent likelihood ratio test.  The second model uses the time from the start of the transplant program (10/1/1967) until the patient entered the program.  The sign of the effect suggests that waiting times decreased as the program continued. The likelihood ratio test indicates that this is statistically significant.
TIME wait @
CASES prestat @
FIT @
Data not sorted on TIME
Data now being sorted.................
Hazard function regression model
Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
WAIT     is used for survival time.
PRESTAT  is used for outcomes
     Deviance  =     221.001
    Free parameters         =       0
Number of risk sets       =      23
TRAN acc =      (julian(accyr,accmo,accdy) -   #c0167)/365.25@
NULLFIT acc @
LRT
            Iter  Step Deviance
              0    0   221.0006
              1    0   214.3925
              2    0   214.3904
              3    0   214.3904
Hazard function regression model
Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
WAIT     is used for survival time.
PRESTAT  is used for outcomes
                              Parameter Summary Table
 #  Name                             Estimate    Std.Err.   Score       Status
-- -------------------------  ----------- ----------- ----------   -------
Log-linear term 0
1 ACC .....................     -0.2600         0.1040  -0.471E-09   Free
     Deviance  =     214.390
     Free parameters           =       1
     Number of risk sets       =      23
     LR statistic   =      6.610        df =     1

These analyses consider survival time for the 65 men who actually received a transplant.  This subset of cases is selected interactively.  The case indicator is changed to survival status and the time scale to post-transplant survival time.The model fit includes age at acceptance in to the program, an indicator of a history of heart surgery, and a mismatch score.
SELECT trns == 1 and antigen >= 0 @ 
    65 records to be used
CASES surv @ TIME post @   FIT age surgery mismtch @
Data not sorted on TIME
Data now being sorted.................
         Iter  Step Deviance
           0    0   290.8655
           1    0   277.1042
           2    0   276.9394
           3    0   276.9392
          4    0   276.9392
Hazard function regression model
Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
 Using  TRNS == 1 AND ANTIGEN >= 0
POST     is used for survival time.
SURV     is used for outcomes
                             Parameter Summary Table

#   Name                            Estimate    Std.Err.      Score         Status
-- -------------------------  -----------  -----------   ----------     -------
 Log-linear term 0
1 AGE .....................           0.05155     0.02201   0.281E-10   Free
2 SURGERY .................     -0.8225      0.4846   -0.318E-09   Free
3 MISMTCH .................      0.4913      0.2911     0.215E-10   Free       Deviance  =     276.939      Free parameters           =       3                                   Number of risk sets       =      39

We now consider models for both pre- and post-transplant survival.  The models will make use of  a time-dependent indicator variable for transplant status.The time indicator is changed to survival time (from acceptance into the program).  The first model has no covariates and is used as a null model for subsequent tests.The TTRAN command is used to define time-dependent covariates.  The variable %time is a special variable that contains the current time for the risk set.The first model includes only the transplant indicator.
 NOMODEL @
 SELECT @
Model has been reset
       103 records to be used
CASES surv @
TIME stime @
FIT @ NULL @
Data not sorted on TIME
Data now being sorted.................
Hazard function regression model
Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
 STIME    is used for survival time.
 SURV     is used for outcomes
      Deviance  =     594.386
Free parameters           =       0     Number of risk sets       =      62
TRAN
   ht = 0 ; preht = 1 @
TTRAN ht = (%time > wait ) @
FIT ht @   LRT
        Iter  Step Deviance
          0    0   594.3860
          1    0   594.3775
          2    0   594.3775
Hazard function regression model with time-dependent covariates
Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
 STIME    is used for survival time.
 SURV     is used for outcomes
                             Parameter Summary Table
 #   Name                           Estimate    Std.Err.   Score       Status
-- -------------------------   ----------- ----------- ----------   -------
 Log-linear term 0
 1 HT ......................        -0.02796      0.3020   0.181E-08   Free
      Deviance  =     594.377      Free parameters         = 1
                                                 Number of risk sets    = 62                                   Non-informative risk sets =       1
     LR statistic   =     0.8545E-02    df =     1            P   =      0.9263
 
The age at transplant is computed and added to the previous model in a interaction with heart transplant status.
TRAN trage = (julian(tryr,trmo,trdy) - julian(byr,bmo,bdy))/365.25 @
FIT + ht*trage @
          Iter  Step Deviance
            0    0   594.3775
            1    0   587.3064
            2    0   587.0111
            3    0   587.0104
            4    0   587.0104
 Hazard function regression model with time-dependent covariates
 Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
 STIME    is used for survival time.
 SURV     is used for outcomes
                            Parameter Summary Table
  # Name                            Estimate    Std.Err.   Score         Status
 -- ------------------------    ----------- ----------- ----------    -------
 Log-linear term 0
 1 HT ......................         -2.746       1.146       -0.400E-09   Free
 2 HT * TRAGE ............. 0.05698     0.02243  -0.690E-10   Free       Deviance  =     587.010      Free parameters           =       2                                   Number of risk sets       =      62               Non-informative risk sets =       1  LRT
               LR statistic   =      7.376        df =     2
                              P   =      0.0250

A final model involving various factors that are believed to affect pre- and post-transplant survival is fit.  To fit this model, a pre-transplant time dependent covariate is defined.  This TTRAN command adds the new transformations to those specified previously.  (The NOTTRAN command is used to remove time-dependent transformations).
TTRAN preht = 1 - ht @
FIT preht*acc preht*surgery preht*age ht ht*acc ht*surgery ht*age @
          Iter  Step Deviance
            0    0   594.3860
            1    0   575.6942
            2    0   575.5826
            3    0   575.5825
 Hazard function regression model with time-dependent covariates
 Product additive excess RR model {RR = T0*(1 + T1 + T2 + ...)}
 STIME    is used for survival time.
 SURV     is used for outcomes
                             Parameter Summary Table
  #   Name                          Estimate      Std.Err.   Score         Status
 -- -----------------------    -----------   -----------  ----------     -------
 Log-linear term 0
 1 PREHT * ACC ............  -0.2478      0.1056   0.148E-05   Free
 2 PREHT * SURGERY ..  -0.3314      0.6271   0.323E-06   Free
 3 PREHT * AGE ............   0.01266    0.01655  0.272E-05  Free
 4 HT ......................           -2.726       1.412     -0.578E-05   Free
 5 HT * ACC ................     -0.02178    0.09594 -0.333E-05  Free
 6 HT * SURGERY .......... -0.7913      0.4534   -0.941E-05  Free
 7 HT * AGE ................      0.05122    0.02148 -0.299E-05  Free       Deviance  =     575.583      Free parameters           =       7

Return to HiroSoft's Home Page
Back to the directory of examples
Back to the PEANUTS overview