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 = "ADSL",
aval_var = teal.picks::variables("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.picks::values(c(0.95, 0.9, 0.8), 0.95),
add_total = FALSE,
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
(
teal.picks::variables(); legacyteal.transformobjects are deprecated but still accepted)
object with all available choices and pre-selected option for the analysis variable.- arm_var
(
teal.picks::variables(); legacyteal.transformobjects are deprecated but still accepted)
object with all available choices and preselected option for variable names that can be used asarm_var. It defines the grouping variable in the results table.- strata_var
(
teal.picks::variables(); legacyteal.transformobjects are deprecated but still accepted)
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
(
teal.picks::variables(); legacyteal.transformobjects are deprecated but still accepted)
optional offset column (dataname).- cov_var
(
teal.picks::variables(); legacyteal.transformobjects are deprecated but still accepted)
object with all available choices and preselected option for the covariates variables.- arm_ref_comp
(
list) optional,
if specified it must be a named list with each element corresponding to an arm variable inADSLand the element must be another list (possibly with delayedteal.picks::variables()orteal.picks::values(); legacyteal.transform::variable_choices()andteal.transform::value_choices()are deprecated but still accepted) with the elements namedrefandcompthat define the default reference and comparison arms when the arm variable is changed.- conf_level
(
teal.picks::values(); legacyteal.transform::choices_selected()is deprecated but still accepted)
available confidence levels and default selection, each in the range (0, 1).- add_total
(
logical)
initial value for the “Add All Patients column” checkbox when comparing arms.- 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_argsand 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
(
listofteal_transform_module) that will be applied to transform module's data input. To learn more checkvignette("transform-input-data", package = "teal").- decorators
-
(named
listof 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
parentnamedata.
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.
Reporting
This module returns an object of class teal_module, that contains a server function.
Since the server function returns a teal_report object, this makes this module reportable, which means that
the reporting functionality will be turned on automatically by the teal framework.
For more information on reporting in teal, see the vignettes:
vignette("reportable-shiny-application", package = "teal.reporter")vignette("adding-support-for-reporting-to-custom-modules", package = "teal")
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 = variables(
choices = c("ARM", "ARMCD", "ACTARMCD"),
selected = "ARMCD"
),
arm_ref_comp = arm_ref_comp,
aval_var = variables(choices = "AVAL", fixed = TRUE),
strata_var = variables(choices = "SEX", selected = NULL),
offset_var = variables(choices = "AGE", selected = NULL),
cov_var = variables(choices = "SITEID", selected = NULL)
)
)
)
#> Initializing tm_t_glm_counts
if (interactive()) {
shinyApp(app$ui, app$server)
}