coxph_hr {junco} | R Documentation |
Workaround statistics function to add HR with CI
Description
This is a workaround for tern::s_coxph_pairwise()
, which adds a statistic
containing the hazard ratio estimate together with the confidence interval.
Usage
a_coxph_hr(
df,
.var,
ref_path,
.spl_context,
...,
.stats = NULL,
.formats = NULL,
.labels = NULL,
.indent_mods = NULL
)
s_coxph_hr(
df,
.ref_group,
.in_ref_col,
.var,
is_event,
strata = NULL,
control = control_coxph(),
alternative = c("two.sided", "less", "greater")
)
Arguments
df |
( |
.var |
( |
ref_path |
( |
.spl_context |
( |
... |
additional arguments for the lower level functions. |
.stats |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
.ref_group |
( |
.in_ref_col |
( |
is_event |
( |
strata |
( |
control |
( |
alternative |
( |
Value
for s_coxph_hr
a list containing the same statistics returned by tern::s_coxph_pairwise
and the additional lr_stat_df
statistic. for a_coxph_hr
, a VerticalRowsSection
object.
Functions
-
a_coxph_hr()
: Formatted analysis function which is used asafun
. -
s_coxph_hr()
: Statistics function forked fromtern::s_coxph_pairwise()
. the difference is that:It returns the additional statistic
lr_stat_df
(log rank statistic with degrees of freedom).
Examples
library(dplyr)
adtte_f <- tern::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() |>
analyze("AVAL",
afun = s_coxph_hr,
extra_args = list(is_event = "is_event"),
var_labels = "Unstratified Analysis",
show_labels = "visible"
) |>
build_table(df = adtte_f)
basic_table() |>
split_cols_by(var = "ARMCD", ref_group = "ARM A") |>
add_colcounts() |>
analyze("AVAL",
afun = s_coxph_hr,
extra_args = list(
is_event = "is_event",
strata = "SEX",
control = tern::control_coxph(pval_method = "wald")
),
var_labels = "Unstratified Analysis",
show_labels = "visible"
) |>
build_table(df = adtte_f)
adtte_f <- tern::tern_ex_adtte |>
dplyr::filter(PARAMCD == "OS") |>
dplyr::mutate(is_event = CNSR == 0)
df <- adtte_f |> dplyr::filter(ARMCD == "ARM A")
df_ref <- adtte_f |> dplyr::filter(ARMCD == "ARM B")
s_coxph_hr(
df = df,
.ref_group = df_ref,
.in_ref_col = FALSE,
.var = "AVAL",
is_event = "is_event",
strata = NULL
)