Dear R users,

i try to calculate the probabilty to survive a given time by using the estimated survival curve by kaplan meier.

What is the right way to do that? as far as is see i cannot use the predict-methods from the survival package?

library(survival)
set.seed(1)
time <- cumsum(rexp(1000)/10)
status <- rbinom(1000, 1, 0.5)

## kaplan meier estimates
fit <- survfit(Surv(time, status) ~ 1)
s <- summary(fit)

## 1. possibility to get the probability for surviving 20 units of time
ind <- findInterval(20, s$time)
cbind(s$surv[ind], s$time[ind])

## 2. possibility to get the probability for surviving 20 units of time
ind <- s$time >= 20
sum(ind) / length(ind)

Thanks and best regards

Andreas

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to