View source: R/bootstrapCI_KM.R
boot_ci_adj_km | R Documentation |
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 )
boot_n |
bootstrap sample size |
ci_cut |
default c(0.025, 0.975) bootstrap 95% CI |
data |
the input dataset |
time |
column name of time variable |
status |
column name of event status |
group |
grouping variable |
covlist |
list of covariates that should be included in the model |
stratified_cox |
"Yes" refers to use stratified model, "No" refers to use coxph regression |
reference_group |
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.