Skip to contents

helper function: sort out a nice report table to summarize survival analysis results

Usage

report_table_tte(coxobj, medSurvobj, tag = NULL)

Arguments

coxobj

returned object from coxph

medSurvobj

returned object from medSurv_makeup

tag

a string, by default NULL, if specified, an extra 1st column is created in the output

Value

a data frame with sample size, incidence rate, median survival time with 95% CI, hazard ratio estimate with 95% CI and Wald test of hazard ratio

Examples

library(survival)
data(adtte_sat)
data(pseudo_ipd_sat)
combined_data <- rbind(adtte_sat[, c("TIME", "EVENT", "ARM")], pseudo_ipd_sat)
unweighted_cox <- coxph(Surv(TIME, EVENT == 1) ~ ARM, data = combined_data)

# Derive median survival time
kmobj <- survfit(Surv(TIME, EVENT) ~ ARM, combined_data, conf.type = "log-log")
medSurv <- medSurv_makeup(kmobj, legend = "before matching", time_scale = "day")

report_table_tte(unweighted_cox, medSurv)
#>   treatment   N n.events(%)     median[95% CI]      HR[95% CI] p-Value
#> 2     ARM=B 300   178(59.3)  83.6[ 68.8;101.1] 2.67[2.16;3.29]  <0.001
#> 1     ARM=A 500   190(38.0) 230.9[191.1;313.2]