Survival Analysis in R
Heidi Seibold
Statistician at LMU Munich
Visualization tools often focus on step functions.
So the following code does NOT work:
wb <- survreg(Surv(time, cens) ~ 1)
ggsurvplot(wb)
wb <- survreg(Surv(time, cens) ~ 1)
Survival curve:
surv <- seq(.99, .01, by = -.01) t <- predict(wb, type = "quantile", p = 1 - surv, newdata = data.frame(1))
surv_wb <- data.frame(time = t, surv = surv, upper = NA, lower = NA, std.err = NA)
Plot:
ggsurvplot_df(fit = surv_wb, surv.geom = geom_line)
Survival Analysis in R