[R] How to access results of survival analysis

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


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?
> Regarding the results of a Cox-PH-model I face the same situation. The
> printed results are:
> 
>>cx.survdur.ipss_mds.sex
> 
> Call:
> coxph(formula = s.survdur ~ x1 + x2, method = "efron")
> 
>        coef exp(coef) se(coef)     z      p
> x1   0.6424      1.90    0.206 3.123 0.0018
> x2.L 0.0616      1.06    0.263 0.234 0.8100
> 
> Likelihood ratio test=9.56  on 2 df, p=0.0084  n=58 (42 observations
> deleted due to missing)
> 
> Is there a simple method to copy e.g. the coefficients and p-values in a
> new object?
> 
> I am working with:
> R : Copyright 2004, The R Foundation for Statistical Computing
> Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
> Survival package version: survival_2.16
> Operating System: Windows 98SE
> 
> Thanks,
> Heinz Tüchler
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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




More information about the R-help mailing list