survival_biomarkers_subgroups {tern} | R Documentation |
Tabulate biomarker effects on survival by subgroup
Description
Tabulate the estimated effects of multiple continuous biomarker variables across population subgroups.
Usage
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
)
Arguments
df |
( |
vars |
(
|
groups_lists |
(named |
control |
( |
label_all |
|
time_unit |
( |
na_str |
( |
.indent_mods |
(named |
Details
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.
Value
An rtables
table summarizing biomarker effects on survival by subgroup.
Functions
-
tabulate_survival_biomarkers()
: Table-creating function which creates a table summarizing biomarker effects on survival by subgroup.
Note
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.
See Also
h_tab_surv_one_biomarker()
which is used internally, extract_survival_biomarkers()
.
Examples
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))