[R] Function Surv and interpretation

Terry Therneau therneau at mayo.edu
Mon May 18 14:56:58 CEST 2009


Dr Pearce,
 
  1. The heart of your question is why Surv(time, death) works, when the 
standard S action would be to match "death" to the "time2" argument.
   The answer is that Surv is not conventional -- if only 2 unnamed arguments 
are present, then it assumes that they match to the time and event arguments.  
At least in my work, 99% of the uses of survival are either (time1, time2, 
status) or (time, status); so the function was made convenient for the most 
common case.
   
   2. Q2: why did Surv(time, event=death) give an error message?  This was a 
programming error which has been corrected in the most recent version of the 
code.
   
   3. I'm not familiar with the details of the cuminc function (I assume from 
the cmprsk package).  However, with the newest version of survival you can use 
the alternative:
    fit <- survfit(Surv(ftime, fstatus>0) ~ group, event=fstatus, data=mydata)

The result is a standard survival curve object, so all of the usual plotting 
methods for survival curves work, e.g.,
    plot(fit[1:3], fun='event', col=c(2,7,5), lty=c(1,2,2))
    
In the survfit formulation 'status' is still 0/1 for censored/uncensored, and 
'event' gives the event type for the deaths.  The event code for the censors is 
ignored and can be any value (but don't use NA - that will cause the observation 
to be dropped).

   	Terry Therneau




More information about the R-help mailing list