| survival_coxph_pairwise {tern} | R Documentation |
Pairwise Cox-PH model
Description
Summarize p-value, HR and CIs from stratified or unstratified Cox-PH model.
Usage
coxph_pairwise(
lyt,
vars,
na_str = default_na_str(),
nested = TRUE,
...,
var_labels = "CoxPH",
show_labels = "visible",
table_names = vars,
.stats = c("pvalue", "hr", "hr_ci"),
.formats = NULL,
.labels = NULL,
.indent_mods = NULL
)
s_coxph_pairwise(
df,
.ref_group,
.in_ref_col,
.var,
is_event,
strata = NULL,
strat = lifecycle::deprecated(),
control = control_coxph()
)
a_coxph_pairwise(
df,
.ref_group,
.in_ref_col,
.var,
is_event,
strata = NULL,
strat = lifecycle::deprecated(),
control = control_coxph()
)
Arguments
lyt |
( |
vars |
( |
na_str |
( |
nested |
( |
... |
additional arguments for the lower level functions. |
var_labels |
( |
show_labels |
( |
table_names |
( |
.stats |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
df |
( |
.ref_group |
( |
.in_ref_col |
( |
.var |
( |
is_event |
( |
strata |
( |
strat |
|
control |
(
|
Value
-
coxph_pairwise()returns a layout object suitable for passing to further layouting functions, or tortables::build_table(). Adding this function to anrtablelayout will add formatted rows containing the statistics froms_coxph_pairwise()to the table layout.
-
s_coxph_pairwise()returns the statistics:-
pvalue: p-value to test HR = 1. -
hr: Hazard ratio. -
hr_ci: Confidence interval for hazard ratio. -
n_tot: Total number of observations. -
n_tot_events: Total number of events.
-
-
a_coxph_pairwise()returns the corresponding list with formattedrtables::CellValue().
Functions
-
coxph_pairwise(): Layout-creating function which can take statistics function arguments and additional format arguments. This function is a wrapper forrtables::analyze(). -
s_coxph_pairwise(): Statistics function which analyzes HR, CIs of HR and p-value of acoxphmodel. -
a_coxph_pairwise(): Formatted analysis function which is used asafunincoxph_pairwise().
Examples
library(dplyr)
adtte_f <- tern_ex_adtte %>%
filter(PARAMCD == "OS") %>%
mutate(is_event = CNSR == 0)
df <- adtte_f %>% filter(ARMCD == "ARM A")
df_ref_group <- adtte_f %>% filter(ARMCD == "ARM B")
basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
add_colcounts() %>%
coxph_pairwise(
vars = "AVAL",
is_event = "is_event",
var_labels = "Unstratified Analysis"
) %>%
build_table(df = adtte_f)
basic_table() %>%
split_cols_by(var = "ARMCD", ref_group = "ARM A") %>%
add_colcounts() %>%
coxph_pairwise(
vars = "AVAL",
is_event = "is_event",
var_labels = "Stratified Analysis",
strata = "SEX",
control = control_coxph(pval_method = "wald")
) %>%
build_table(df = adtte_f)