tm_a_mmrm | R Documentation |
This module produces analysis tables and plots for Mixed Model Repeated Measurements.
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(),
transformators = list(),
decorators = list()
)
a teal_module
object.
This module generates the following objects, which can be modified in place using decorators:
lsmeans_plot
(ggplot
)
diagnostic_plot
(ggplot
)
lsmeans_table
(TableTree
- output from rtables::build_table
)
covariance_table
(ElementaryTable
- output from rtables::build_table
)
fixed_effects_table
(ElementaryTable
- output from rtables::build_table
)
diagnostic_table
(ElementaryTable
- output from rtables::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_a_mrmm( ..., # arguments for module decorators = list( lsmeans_plot = teal_transform_module(...), # applied only to `lsmeans_plot` output diagnostic_plot = teal_transform_module(...), # applied only to `diagnostic_plot` output lsmeans_table = teal_transform_module(...), # applied only to `lsmeans_table` output covariance_table = teal_transform_module(...), # applied only to `covariance_table` output fixed_effects_table = teal_transform_module(...), # applied only to `fixed_effects_table` output diagnostic_table = teal_transform_module(...) # applied only to `diagnostic_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.
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.
The TLG Catalog where additional example apps implementing this module can be found.
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
)
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.