boot_ci_adj_km.Rd
Use input data, time, status,grouping variables, adjusted covariates, events of interests, whether to use stratified model, and defining reference group as inputs
boot_ci_adj_km(
boot_n = 100,
ci_cut = c(0.025, 0.975),
data,
time,
status,
group,
covlist,
stratified_cox,
reference_group
)
bootstrap sample size
default c(0.025, 0.975) bootstrap 95% CI
the input dataset
column name of time variable
column name of event status
grouping variable
list of covariates that should be included in the model
"Yes" refers to use stratified model, "No" refers to use coxph regression
NULL- unstratified coxph when stratified = No; "G&B"- G&B when stratified = Yes; Otherwise, Storer's approach will be performed when using a self-defined reference
Output is a dataframe with average number of adjusted survival probabilities, as well as 2.5% and 97.5% percentiles.
# Data preparation
library(KMsurv)
data(bmt)
bmt$arm <- bmt$group
bmt$arm = factor(as.character(bmt$arm), levels = c("2", "1", "3"))
bmt$z3 = as.character(bmt$z3)
bmt$t2 = bmt$t2 * 12/365.25
# Unstratified cox
result1_1 = boot_ci_adj_km(boot_n = 100, ci_cut = c(0.025, 0.975), data = bmt, time = "t2",
status = "d3", group = "arm", covlist = c("z1", "z3"), stratified_cox = "No",
reference_group = NULL)
# Stratified Cox: Gail and Byar's method
result1_2 = boot_ci_adj_km(boot_n = 100, ci_cut = c(0.025, 0.975), data = bmt, time = "t2",
status = "d3", group = "arm", covlist = c("z1", "z3"), stratified_cox = "Yes",
reference_group = "G&B")
# Stratified Cox: Storer's approach
result1_3 = boot_ci_adj_km(boot_n = 100, ci_cut = c(0.025, 0.975), data = bmt, time = "t2",
status = "d3", group = "arm", covlist = c("z1", "z3"), stratified_cox = "Yes",
reference_group = "arm:2")