13 lines
358 B
R
Raw Normal View History

2025-01-12 00:52:51 +08:00
## Reported by Duncan Murdoch (from StackOverflow) 2021-02-04
library(survival)
library(boot)
statMeanSurv <- function(data, var) {
surv <- survfit(Surv(time, cens) ~ 1, data = data)
mean(surv$surv) + var
}
## both have datasets aml
res <- censboot(boot::aml, statMeanSurv, R = 5L, var = 1,
parallel = "multicore", ncpus = 2L)
res$t