[R] RV: help

Dieter Menne dieter.menne at menne-biomed.de
Fri Mar 6 09:44:23 CET 2009


Jani Lobo <lobo <at> grupocomar.com> writes:

> I want to estimate the survival mean of a few specific teams. I'm trying to
> calculate it through a Kaplan Meier estimator. For doing so, I load the
> "survival" package and run the following instructions: 
> 
> "options(survfit.print.mean=TRUE)"      allows showing the mean and mean
> standard error 
> 
> "KM=survfit(Surv(Dias,Censura))"          runs the model
> 
> "KM"                                     shows the model
> 
> It is in this very moment when it shows the mean value and the mean standard
> error.
> 
> I'd like to know if there is any instruction that returns the mean value and
> its standard error, something like:
> 
> "KM$rmean"
> 

It's always good to use an example that can be run by other people, 
and it is easy: just use the example from the documentation

library(survival)
fit <- survfit(Surv(time, status) ~ x, data=aml)
# str tells you what fit has to offer
str(fit)

### Too bad, no summary data available here, looks
## like print.survfit does the job
getAnywhere(print.survfit)

Checking the code: there are a lot of print statements in here, 
and the summary results are not returned. Now you have two choices: 
either use the code from print.survfit, copy it, and get the values
you need from a changed function. Can be some work.

Or check if someone else has done the work for you, and bingo:

summary.survfit in package Design looks like it is doing the job.

Dieter
















summary.survfit {Design}




More information about the R-help mailing list