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'))
plot_survival(dat$followT, dat$event, xlim=c(0,40))
fit_res <- pwexpm(Surv(followT, event), data = dat, nbreak = 2)
plot_survival(fit_res, col='red', lwd=3, breakpoint_par = list(col='grey', lwd=2.5))
Run the code above in your browser using DataLab