Skip to contents

Extract and display median survival time with confidence interval

Usage

medSurv_makeup(km_fit, legend = "before matching", time_scale)

Arguments

km_fit

returned object from survival::survfit

legend

a character string, name used in 'type' column in returned data frame

time_scale

a character string, 'years', 'months', 'weeks' or 'days', time unit of median survival time

Value

a data frame with a index column 'type', median survival time and confidence interval

Examples

data(adtte_sat)
data(pseudo_ipd_sat)
library(survival)
combined_data <- rbind(adtte_sat[, c("TIME", "EVENT", "ARM")], pseudo_ipd_sat)
kmobj <- survfit(Surv(TIME, EVENT) ~ ARM, combined_data, conf.type = "log-log")

# Derive median survival time
medSurv <- medSurv_makeup(kmobj, legend = "before matching", time_scale = "day")
medSurv
#>   treatment            type records n.max n.start events    rmean se(rmean)
#> 1         A before matching     500   500     500    190 265.1012  10.80981
#> 2         B before matching     300   300     300    178 130.9893  10.24910
#>      median   0.95LCL  0.95UCL
#> 1 230.94839 191.10767 313.1574
#> 2  83.58535  68.82298 101.0786