adjusted_KM.Rd
Use input data, time, status, grouping variables, adjusted covariates, whether to use stratified model, and reference group as inputs
adjusted_KM(
data,
time,
status,
group,
covlist,
stratified_cox = "Yes",
reference_group = "G&B"
)
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
NULL- unstratified cox 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 survival 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.
# 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
# Cox model
result1 = adjusted_KM(data = bmt, time = "t2", status = "d3", group = "arm", covlist = c("z1",
"z3"), stratified_cox = "No", reference_group = NULL)
# Stratified cox: Gail&Byar's approach
result2 = adjusted_KM(data = bmt, time = "t2", status = "d3", group = "arm", covlist = c("z1",
"z3"), stratified_cox = "Yes", reference_group = "G&B")
# Stratified cox: Storer's approach
result3 = adjusted_KM(data = bmt, time = "t2", status = "d3", group = "arm", covlist = c("z1",
"z3"), stratified_cox = "Yes", reference_group = "arm:2")