Summarize results of a Poisson negative binomial regression that is result of a generalized linear model of one (e.g. arm) or more covariates.
Usage
tm_t_glm_counts(
label = "Counts Module",
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVAL"), "AVAL", fixed = TRUE),
arm_var,
strata_var,
rate_mean_method = c("emmeans", "ppmeans"),
distribution = c("negbin", "quasipoisson", "poisson"),
offset_var,
cov_var,
arm_ref_comp = NULL,
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
- label
(
character
)
menu item label of the module in the teal app.- dataname
(
character
)
analysis data used in teal module.- parentname
(
character
)
parent analysis data used in teal module, usually this refers toADSL
.- aval_var
(
character
)
name of the analysis value variable.- arm_var
(
character
)
variable names that can be used asarm_var
.- strata_var
(
character
)
names of the variables for stratified analysis.- rate_mean_method
(
character
) method used to estimate the mean odds ratio. Either "emmeans" or "ppmeans" (as insummarize_glm_count()
).- distribution
(
character
) value specifying the distribution used in the regression model (Poisson:"poisson"
, Quasi-Poisson:"quasipoisson"
, negative binomial:"negbin"
).- offset_var
(
character
) a name of the numeric variable to be used as an offset?- cov_var
(
character
)
names of the covariates variables.- arm_ref_comp
(
list
) optional,
if specified it must be a named list with each element corresponding to an arm variable inADSL
and the element must be another list (possibly with delayedteal.transform::variable_choices()
or delayedteal.transform::value_choices()
with the elements namedref
andcomp
that the defined the default reference and comparison arms when the arm variable is changed.- conf_level
(
teal.transform::choices_selected()
)
object with all available choices and pre-selected option for confidence level, each within range of (0, 1).- pre_output
(
shiny.tag
) optional,
with text placed before the output to put the output into context. For example a title.- post_output
(
shiny.tag
) optional,
with text placed after the output to put the output into context. For example theshiny::helpText()
elements are useful.- basic_table_args
(
basic_table_args
) optional
object created byteal.widgets::basic_table_args()
with settings for the module table. The argument is merged with optionteal.basic_table_args
and with default module arguments (hard coded in the module body). For more details, see the vignette:vignette("custom-basic-table-arguments", package = "teal.widgets")
.- transformators
(
list
ofteal_transform_module
) that will be applied to transform module's data input. To learn more checkvignette("transform-input-data", package = "teal")
.- decorators
-
(named
list
of lists ofteal_transform_module
) optional, decorator for tables or plots included in the module output reported. The decorators are applied to the respective output objects.See section "Decorating Module" below for more details.
Details
Teal module for
tern::summarize_glm_count()
analysis, that summarizes results of a Poisson negative binomial regression.The arm and stratification variables are taken from the
parentname
data.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
table
(TableTree
- output ofrtables::build_table()
)
A Decorator is applied to the specific output using a named list of teal_transform_module
objects.
The name of this list corresponds to the name of the output to which the decorator is applied.
See code snippet below:
tm_t_glm_counts(
..., # arguments for module
decorators = list(
table = teal_transform_module(...) # applied only to `table` output
)
)
For additional details and examples of decorators, refer to the vignette
vignette("decorate-module-output", package = "teal.modules.clinical")
.
To learn more please refer to the vignette
vignette("transform-module-output", package = "teal")
or the teal::teal_transform_module()
documentation.
Examples
data <- within(teal_data(), {
ADSL <- tern::tern_ex_adsl
ADTTE <- tern::tern_ex_adtte
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
arm_ref_comp <- list(
ACTARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
),
ARM = list(
ref = "B: Placebo",
comp = c("A: Drug X", "C: Combination")
)
)
ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
# Initialize the teal app
app <- init(
data = data,
modules = modules(
tm_t_glm_counts(
dataname = "ADTTE",
arm_var = choices_selected(
variable_choices(ADTTE, c("ARM", "ARMCD", "ACTARMCD")),
"ARMCD"
),
arm_ref_comp = arm_ref_comp,
aval_var = choices_selected(
variable_choices(ADTTE, "AVAL"),
"AVAL"
),
strata_var = choices_selected(
variable_choices(ADSL, "SEX"),
NULL
),
offset_var = choices_selected(
variable_choices(ADSL, "AGE"),
NULL
),
cov_var = choices_selected(
variable_choices(ADTTE, "SITEID"),
NULL
)
)
)
)
#> Initializing tm_t_glm_counts
if (interactive()) {
shinyApp(ui = app$ui, server = app$server)
}