Aliases: tidy.survfit survfit_tidiers
Keywords:
### ** Examples # feel free to ignore the following lineāit allows {broom} to supply # examples without requiring the model-supplying package to be installed. if (requireNamespace("survival", quietly = TRUE)) { # load libraries for models and data library(survival) # fit model cfit <- coxph(Surv(time, status) ~ age + sex, lung) sfit <- survfit(cfit) # summarize model fit with tidiers + visualization tidy(sfit) glance(sfit) library(ggplot2) ggplot(tidy(sfit), aes(time, estimate)) + geom_line() + geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25) # multi-state fitCI <- survfit(Surv(stop, status * as.numeric(event), type = "mstate") ~ 1, data = mgus1, subset = (start == 0) ) td_multi <- tidy(fitCI) td_multi ggplot(td_multi, aes(time, estimate, group = state)) + geom_line(aes(color = state)) + geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25) }