event_dist <- function(n)rpwexpm(n, rate = c(0.1, 0.01, 0.2), breakpoint = c(5,14))
dat <- simdata(rand_rate = 20, drop_rate = 0.03, total_sample = 1000,
advanced_dist = list(event_dist=event_dist),
add_column = c('censor_reason','event','followT','followT_abs'))
fit_res3 <- boot.pwexpm_fit(dat$followT, dat$event, nbreak = 2, nsim = 10)
# here nsim=10 is for demo purpose. Pls increase it in practice.
plot_survival(dat$followT, dat$event, xlim=c(0,40))
plot_survival(fit_res3, col='red', CI_par = list(col='red'))
brk_ci <- apply(fit_res3$brk, 2, function(x)quantile(x,c(0.025,0.975)))
abline(v=brk_ci, col='grey', lwd=2)
Run the code above in your browser using DataLab