Skip to content

Median In Survival

3 messages · niloo javan, David Winsemius, Marc Schwartz

#
On Feb 22, 2012, at 6:59 PM, niloo javan wrote:

            
That does not look like a formula.

  Furthermore I do not think there is an element in a survfit.object  
named 'median'. (It's certainly not documented on the help pages.)   
Objects are passed to their print methods and the `print.survfit`  
function passes off its data argument first to `survmean`, then to  
`pfun`, then to `minmin` which does the job of calculating a median,  
which print.survfit then prints (as a side-effect using `cat`), but  
never stores in a returned object.

Is this is homework?
#
On Feb 22, 2012, at 7:47 PM, David Winsemius wrote:

            
Yeah, the OP is missing the '~ 1' part:

  survfit(Surv(Time, Status) ~ 1, data = ...)
Perhaps, but the information is available from ?summary.survfit, where the Value section indicates that the returned object includes a 'table' component:
records   n.max n.start  events  median 0.95LCL 0.95UCL 
     26      26      26      12     638     464      NA
median 
   638
0.95LCL 
    464
0.95UCL 
     NA 


This will be a matrix rather than a vector, if the analysis consists of RHS covariates:
records n.max n.start events median 0.95LCL 0.95UCL
rx=1      13    13      13      7    638     268      NA
rx=2      13    13      13      5     NA     475      NA

...
rx=1 rx=2 
 638   NA 


If memory serves, the 'table' component was added about three years ago, as previously, one would have to use capture.output() on the result of explicitly using print.survfit() and then parse the textual results to get the median and CI's. It was one of those 'infelicities' in using these functions where the print method included code to calculate new values, rather than simply printing the results derived in the core function.

HTH,

Marc Schwartz