[R] Time interactions for coxph object

Therneau, Terry M., Ph.D. therneau at mayo.edu
Tue Apr 8 14:59:57 CEST 2014

  The very first step is to understand the possible nature of proportional hazards.  This 
is parallel to the usual advice in linear models to graph the data before you start 
fitting complicated non-linear models.
  zp <- cox.zph(CSHR.shore.fly, transform="identity")
  plot(zp)    # or plot(zp[3]) for the third variable of a model, but you have only 1

This looks at the working model hazard = exp( beta(t) * x); a time dependent coefficient.
Propoprtional hazards corresponds to a horizontal line, i.e., beta(t) = constant.

The steps are
   1. Visualize
   2. THINK
   3. Act appropriately

The tt addition to coxph allows complex time-dependent coefficients and is explained in a 
vignette. (See ?vignette). I've seen scores of data sets with non-proportional hazards, 
and used the tt functionality perhaps 3 times.  Don't jump too quickly into complexity.

Terry Therneau

-----  begin included message ---------

Hi All,

I am working in the 'survival' library and need to know how to code a
variable time interaction for left truncated data (not all subjects
followed from the start of the study). I therefor add in the entry time and
exit time variables into the formula.

Here is my basic formula

     CSHR.shore.fly <- coxph(Surv(entry, exit, to == 1) ~ shore.cat, data

My variable shore.cat is violating the proportional hazards assumption so I
am trying to add in an interaction with time. Do I interact exit? entry? or
the range of the two?

More information about the R-help mailing list