survival_biomarkers_subgroups | R Documentation |
The tabulate_survival_biomarkers()
function creates a layout element to tabulate the estimated effects of multiple
continuous biomarker variables on survival across subgroups, returning statistics including median survival time and
hazard ratio for each population subgroup. The table is created from df
, a list of data frames returned by
extract_survival_biomarkers()
, with the statistics to include specified via the vars
parameter.
A forest plot can be created from the resulting table using the g_forest()
function.
tabulate_survival_biomarkers(
df,
vars = c("n_tot", "n_tot_events", "median", "hr", "ci", "pval"),
groups_lists = list(),
control = control_coxreg(),
label_all = lifecycle::deprecated(),
time_unit = NULL,
na_str = default_na_str(),
.indent_mods = 0L
)
These functions create a layout starting from a data frame which contains the required statistics. The tables are then typically used as input for forest plots.
An rtables
table summarizing biomarker effects on survival by subgroup.
tabulate_survival_biomarkers()
: Table-creating function which creates a table
summarizing biomarker effects on survival by subgroup.
In contrast to tabulate_survival_subgroups()
this tabulation function does
not start from an input layout lyt
. This is because internally the table is
created by combining multiple subtables.
h_tab_surv_one_biomarker()
which is used internally, extract_survival_biomarkers()
.
library(dplyr)
adtte <- tern_ex_adtte
# Save variable labels before data processing steps.
adtte_labels <- formatters::var_labels(adtte)
adtte_f <- adtte %>%
filter(PARAMCD == "OS") %>%
mutate(
AVALU = as.character(AVALU),
is_event = CNSR == 0
)
labels <- c("AVALU" = adtte_labels[["AVALU"]], "is_event" = "Event Flag")
formatters::var_labels(adtte_f)[names(labels)] <- labels
# Typical analysis of two continuous biomarkers `BMRKR1` and `AGE`,
# in multiple regression models containing one covariate `RACE`,
# as well as one stratification variable `STRATA1`. The subgroups
# are defined by the levels of `BMRKR2`.
df <- extract_survival_biomarkers(
variables = list(
tte = "AVAL",
is_event = "is_event",
biomarkers = c("BMRKR1", "AGE"),
strata = "STRATA1",
covariates = "SEX",
subgroups = "BMRKR2"
),
label_all = "Total Patients",
data = adtte_f
)
df
# Here we group the levels of `BMRKR2` manually.
df_grouped <- extract_survival_biomarkers(
variables = list(
tte = "AVAL",
is_event = "is_event",
biomarkers = c("BMRKR1", "AGE"),
strata = "STRATA1",
covariates = "SEX",
subgroups = "BMRKR2"
),
data = adtte_f,
groups_lists = list(
BMRKR2 = list(
"low" = "LOW",
"low/medium" = c("LOW", "MEDIUM"),
"low/medium/high" = c("LOW", "MEDIUM", "HIGH")
)
)
)
df_grouped
## Table with default columns.
tabulate_survival_biomarkers(df)
## Table with a manually chosen set of columns: leave out "pval", reorder.
tab <- tabulate_survival_biomarkers(
df = df,
vars = c("n_tot_events", "ci", "n_tot", "median", "hr"),
time_unit = as.character(adtte_f$AVALU[1])
)
## Finally produce the forest plot.
g_forest(tab, xlim = c(0.8, 1.2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.