tm_a_mmrm {teal.modules.clinical} | R Documentation |
teal Module: Mixed Model Repeated Measurements (MMRM) Analysis
Description
This module produces analysis tables and plots for Mixed Model Repeated Measurements.
Usage
tm_a_mmrm(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
aval_var,
id_var,
arm_var,
visit_var,
cov_var,
arm_ref_comp = NULL,
paramcd,
method = teal.transform::choices_selected(c("Satterthwaite", "Kenward-Roger",
"Kenward-Roger-Linear"), "Satterthwaite", keep_order = TRUE),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
total_label = default_total_label(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
ggplot2_args = teal.widgets::ggplot2_args()
)
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 to ADSL .
|
aval_var |
(teal.transform::choices_selected() ) object with
all available choices and pre-selected option for the analysis variable.
|
id_var |
(teal.transform::choices_selected() ) object specifying
the variable name for subject id.
|
arm_var |
(teal.transform::choices_selected() ) object with all
available choices and preselected option for variable names that can be used as arm_var .
It defines the grouping variable(s) in the results table.
If there are two elements selected for arm_var ,
second variable will be nested under the first variable.
|
visit_var |
(teal.transform::choices_selected() ) object with
all available choices and preselected option for variable names that can be used as visit variable.
Must be a factor in dataname .
|
cov_var |
(teal.transform::choices_selected() ) 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 in ADSL and the element must be another list (possibly
with delayed teal.transform::variable_choices() or delayed teal.transform::value_choices()
with the elements named ref and comp that the defined the default
reference and comparison arms when the arm variable is changed.
|
paramcd |
(teal.transform::choices_selected() ) object with all
available choices and preselected option for the parameter code variable from dataname .
|
method |
(teal.transform::choices_selected() ) object with
all available choices and pre-selected option for the adjustment method.
|
conf_level |
(teal.transform::choices_selected() ) object with
all available choices and pre-selected option for the confidence level, each within range of (0, 1).
|
plot_height |
(numeric ) optional vector of length three with c(value, min, max) . Specifies the
height of the main plot and renders a slider on the plot to interactively adjust the plot height.
|
plot_width |
(numeric ) optional vector of length three with c(value, min, max) . Specifies the width
of the main plot and renders a slider on the plot to interactively adjust the plot width.
|
total_label |
(string ) string to display as total column/row label if column/row is
enabled (see add_total ). Defaults to "All Patients" . To set a new default total_label to
apply in all modules, run set_default_total_label("new_default") .
|
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 the shiny::helpText() elements are useful.
|
basic_table_args |
(basic_table_args ) optional object created by teal.widgets::basic_table_args()
with settings for the module table. The argument is merged with option teal.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") .
|
ggplot2_args |
(ggplot2_args ) optional object created by teal.widgets::ggplot2_args()
with settings for all the plots or named list of ggplot2_args objects for plot-specific settings.
List names should match the following: c("default", "lsmeans", "diagnostic") . The argument is merged
with option teal.ggplot2_args and with default module arguments (hard coded in the module body).
For more details, see the help vignette: vignette("custom-ggplot2-arguments", package = "teal.widgets") .
|
Value
a teal_module
object.
Note
The ordering of the input data sets can lead to slightly different numerical results or
different convergence behavior. This is a known observation with the used package
lme4
. However, once convergence is achieved, the results are reliable up to
numerical precision.
See Also
The TLG Catalog where additional example
apps implementing this module can be found.
Examples
library(dplyr)
arm_ref_comp <- list(
ARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
)
)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADQS <- tmc_ex_adqs %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
filter(AVISIT %in% c("WEEK 1 DAY 8", "WEEK 2 DAY 15", "WEEK 3 DAY 22")) %>%
mutate(
AVISIT = as.factor(AVISIT),
AVISITN = rank(AVISITN) %>%
as.factor() %>%
as.numeric() %>%
as.factor() #' making consecutive numeric factor
)
})
datanames <- c("ADSL", "ADQS")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
app <- init(
data = data,
modules = modules(
tm_a_mmrm(
label = "MMRM",
dataname = "ADQS",
aval_var = choices_selected(c("AVAL", "CHG"), "AVAL"),
id_var = choices_selected(c("USUBJID", "SUBJID"), "USUBJID"),
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
visit_var = choices_selected(c("AVISIT", "AVISITN"), "AVISIT"),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
choices = value_choices(data[["ADQS"]], "PARAMCD", "PARAM"),
selected = "FKSI-FWB"
),
cov_var = choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
[Package
teal.modules.clinical version 0.9.1
Index]