[R] Plot survival analysis with time dependent variables

Terry Therneau therneau at mayo.edu
Wed Jan 2 15:59:01 CET 2013


On 01/01/2013 05:00 AM, r-help-request at r-project.org wrote:
> Dear all,
> Is there an implementation of Simon&  Makuch method of plotting the survival function with time-dependent variables. I?m only able to find event.chart in Hmisc for the purpose and I would prefer the Simon and Makuch method. I believe stata has it implemented for this purpose, but I cannot find it on CRAN.
>
>
> Simon R, Makuch RW. A non-parametric graphical representation of the relationship between survival and the occurrence of an event: application to responder versus non-responder bias.  Statistics in Medicine 1984; 3: 35-44.
Short answer: it's easy, but I don't think the result is a survival curve.

Long answer:
  1. Write out your data in (start, stop] form, exaclty as you would for a time-dependent 
Cox model.  For example:
     id   time1  time2  status  response
      1     0      24      1      0
      2     0      15      0      0
      2    15      43      1      1
      3     0      31      0      0
   ...

Subject 1 has died without response at time 24.  Subject 2 responded at time 15 and then 
died at time 45.  Subject 3 is censored at 31 and has as yet not responded, etc.

The time dependent Cox model is
      fit <- coxph(Surv(time1, time2, status) ~ response, data=yourdata).
Everyone agrees that this is the right model, and if you read the "score test" line of 
summary(fit) you will have the test discussed in equation 1 and 2 of the Simon and Makuch 
paper.  (Well almost-  if there are 2 deaths tied on the same day there is an n-1 vs n-2 
disagreement between authors with respect to the variance formula, but the effect is trivial.)

2. Hazard functions make sense for time dependent covariates.  It is what the Cox model is 
founded on and we all agree.   Simon and Makuck now make the argument
    a. Hazard functions are nice, but my clients are used to survival curves
    b. When there aren't time-dependent covariates S(t) = exp(-H(t)) where S=survival and 
H=hazard
    c. Let's pretend that the formula in b still makes sense for this case, and apply it.

The R solution for c is trivial: replace "coxph" with "survfit" in the code above.  You 
will get their curves (with proper confidence intervals) and can make plots in the usual way.

3. I don't agree with the argument.  On the positive side, if H1 = H2 (no impact of 
response) then the Cox model will say "nothing here" and the Simon curves will give a 
picture that agrees, as opposed to some of the more boneheaded (but common in the medical 
literature) curves that they show in their figures 2b and 3b.

The problem is that the result is not a survival curve --- I've never figured out exactly 
WHAT it is.  For something to be interpreted as a survival curve there needs to be a set 
of subjects for whom I could hold up the graph and say "this is your future".  Put another 
way, assume that you have the above curves in hand and there is a new patient sitting 
across the desk from you.  What is your answer when he/she says "Doc, which curve am I?".

I tend to view these curves as "primum non nocere", if faced with a client who absolutely 
won't bend when told the truth that there is no good survival curve for time-dependent 
covariates.

Terry Therneau




More information about the R-help mailing list