View source: R/bootstrapCI_CIF.R
boot_ci_adj_cif | 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_cif( boot_n = 100, ci_cut = c(0.025, 0.975), data, time, status, group, covlist, event_code, stratified, 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 |
event_code |
event of interests |
stratified |
"Yes" refers to use stratified model, "No" refers to use Fine and Gray regression |
reference_group |
NULL- unstratified FG 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 CIF probabilities, as well as 2.5% and 97.5% percentiles.
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$CenCI <- 0 for (ii in 1:137) { if (bmt$d3[ii] == 0) { bmt$CenCI[ii] <- 0 } else { if (bmt$d2[ii] == 1) { bmt$CenCI[ii] <- 1 } else { bmt$CenCI[ii] <- 2 } } } bmt$t2 = bmt$t2 * 12/365.25 # unstratified Fine-Gray regression model result1_1 = boot_ci_adj_cif(boot_n = 100, ci_cut = c(0.025, 0.975), data = bmt, time = "t2", status = "CenCI", group = "arm", covlist = c("z1", "z3"), event_code = 1, "No", NULL) # stratified FG: Gail&Byar's approach result1_2 = boot_ci_adj_cif(boot_n = 100, ci_cut = c(0.025, 0.975), data = bmt, time = "t2", status = "CenCI", group = "arm", covlist = c("z1", "z3"), event_code = 1, "Yes", "G&B") # stratified Storer result1_3 = boot_ci_adj_cif(boot_n = 100, ci_cut = c(0.025, 0.975), data = bmt, time = "t2", status = "CenCI", group = "arm", covlist = c("z1", "z3"), event_code = 1, "Yes", "arm:2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.