View source: R/adjusted_CIF_func.R
adjusted_CIF | R Documentation |
Use input data, time, status, grouping variables, adjusted covariates, events of interests, whether to use stratified model, and reference group as inputs
adjusted_CIF( data, time, status, group, covlist, event_code = 1, stratified = "Yes", reference_group = "G&B" )
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 adjusted CIF probabilities. If the PH assumption is invalid or if practitioners need a method by which the event time points of the adjusted function match those of the unadjusted function, the stratified model should be used (Gail and Byar and Storer et. al), otherwise, unstratified FG model can be used.
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 FG result1 = adjusted_CIF(data = bmt, time = "t2", status = "CenCI", group = "arm", covlist = c("z1", "z3"), event_code = 1, stratified = "No", reference_group = NULL) # stratified G&B result2 = adjusted_CIF(data = bmt, time = "t2", status = "CenCI", group = "arm", covlist = c("z1", "z3"), event_code = 1, stratified = "Yes", reference_group = "G&B") # stratified Storer result3 = adjusted_CIF(data = bmt, time = "t2", status = "CenCI", group = "arm", covlist = c("z1", "z3"), event_code = 1, stratified = "Yes", reference_group = "arm:2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.