[R] How to access results of survival analysis

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Feb 5 19:09:39 CET 2005


Heinz Tuechler wrote:

> At 15:19 05.02.2005 +0100, Uwe Ligges wrote:
> 
>>Heinz Tuechler wrote:
>>
>>>Hello,
>>>
>>>it seems that the main results of survival analysis with package survival
>>>are shown only as side effects of the print method.
>>>
>>>If I compute e.g. a Kaplan-Meier estimate by 
>>>
>>>
>>>>km.survdur<-survfit(s.survdur) 
>>>
>>>then I can simply print the results by 
>>>
>>>
>>>>km.survdur
>>>
>>>Call: survfit(formula = s.survdur)
>>>
>>>      n  events  median 0.95LCL 0.95UCL 
>>>  100.0    58.0    46.8    41.0    79.3 
>>>
>>>Is there a simple method to access these results, e.g. if I want to print
>>>only the median with the confidence limits?
> 
> 
> ...
> 
>>No, the print methods do not return those values.
>>But you can copy code for calculation of the required values from those 
>>print methods into your own functions...
>>
>>Uwe Ligges
>>
>>
> 
> Thank you for your answer. I assume, you suggest to use
> capture.output(print(...)). 

No, I suggested to copy the code from survival:::print.survfit and Co. 
that calculates the values you are looking for...

Uwe

 > Without your response I would have believed
> that I had missed an important possibility of R.
> 
> Regarding the Cox-Model Ales Ziberna gave me a useful hint to use summary()
> which returns a list.
> 
> Thanks to both of you,
> 
> Heinz Tüchler




More information about the R-help mailing list