compare_rwPFS.Rd
Compares a range of different rwPFS definitions with respect to event composition, KM median time to event, Hazard ratio relative to the reference, and incremental no. of death events from one rwPFS definition to the next (optional).
compare_rwPFS(
.df,
.labels = NULL,
.reference = NULL,
.incremental_deaths_column = NULL
)
a data frame
character vector. A vector of strings representing the labels that identify the rwPFS endpoints/definitions to be compared (in order of desired appearance in the output table).
character. Label identifying the reference rwPFS definition that others are compared against.
logical. Should the output table contain an additional column comparing the incremental
number of death events captured from one definition to the next? Intended for comparing different death_window_days
parameter values in calc_rwPFS
.
Returns a summary table
if (FALSE) { # \dontrun{
library(dplyr)
library(RwPFS)
library(survival)
#Generate rwPFS endpoints across a range of different definitions
#Starting point is the simprog simulated dataset included in the RwPFS package
df <- simprog %>%
#Start with the "_all_events" rwPFS endpoint
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_all_events" #Label for this rwPFS endpoint (for comparisons)
) %>%
# Add "discard_le_14d" rwPFS
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_discard_le_14d",
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_discard_le_14d" #Label for this rwPFS endpoint (for comparisons)
) %>%
# Add "radiographic_only" rwPFS
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_radiographic_only",
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_radiographic_only" #Label for this rwPFS endpoint (for comparisons)
) %>%
# Add "no_pseudoprogression" rwPFS
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_no_pseudoprogression",
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_no_pseudoprogression" #Label for this rwPFS endpoint (for comparisons)
)
#add an addition rwPFS endpoint where visit gaps are ignored (not used for early censoring)
#On a side note, supplying a custom date column as .visit_gap_start_date can e.g. be used to trick calc_rwPFS into censoring observations early (e.g. at a change of the line of therapy).
#Similarly, progression events can be imputed (e.g. at a line of therapy change) by creating a custom .progression_date column.
df <- df %>%
mutate(
#adding an all_na column
all_na = NA_character_ %>% as.Date()
) %>%
# Add "ignore_visit_gaps" rwPFS
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "all_na", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_ignore_visit_gaps" #Label for this rwPFS endpoint (for comparisons)
)
#Compare the different rwPFS endpoints
df %>%
compare_rwPFS(
.labels = c( #Specify the rwPFS labels to be tabulated (in the desired order)
"_all_events",
"_discard_le_14d",
"_radiographic_only",
"_no_pseudoprogression",
"_ignore_visit_gaps"
),
.reference = "_all_events",
.incremental_deaths_column = FALSE
)
#Generate rwPFS endpoints with different durations of the time window for capturing death events:
df <- simprog %>%
#Start with the "_all_events" rwPFS endpoint
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 0, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_0d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 10, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_10d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 20, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_20d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_30d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 40, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_40d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 50, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_50d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 60, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_60d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 70, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_70d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 80, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_80d_window" #Label for this rwPFS endpoint (for comparisons)
) %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 90, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_90d_window" #Label for this rwPFS endpoint (for comparisons)
)
#Compare them, this time including an "incremental deaths" column
df %>%
compare_rwPFS(
.labels = paste0("_", 0:9*10, "d_window"),#Specify the rwPFS labels to be tabulated (in the desired order)
.reference = "_30d_window",
.incremental_deaths_column = TRUE
)
} # }