summarize_mmrm {junco} | R Documentation |
Dynamic tabulation of MMRM results with tables
Description
These functions can be used to produce tables for MMRM results, within tables which are split by arms and visits. This is helpful when higher-level row splits are needed (e.g. splits by parameter or subgroup).
Usage
s_summarize_mmrm(
df,
.var,
variables,
ref_levels,
.spl_context,
alternative = c("two.sided", "less", "greater"),
show_relative = c("reduction", "increase"),
...
)
a_summarize_mmrm(
df,
.var,
.spl_context,
...,
.stats = NULL,
.formats = NULL,
.labels = NULL,
.indent_mods = NULL
)
Arguments
df |
( |
.var |
( |
variables |
(named |
ref_levels |
( |
.spl_context |
( |
alternative |
( |
show_relative |
should the 'reduction' ( |
... |
eventually passed to |
.stats |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
Value
-
a_summarize_mmrm()
returns the corresponding list with formattedrtables::CellValue()
.
Functions
-
s_summarize_mmrm()
: Statistics function which is extracting estimates, not including any results when in the reference visit, and only showing LS mean estimates when in the reference arm and not in reference visit. It usess_lsmeans()
for the final processing. -
a_summarize_mmrm()
: Formatted analysis function which is used asafun
.
Examples
set.seed(123)
longdat <- data.frame(
ID = rep(DM$ID, 5),
AVAL = c(
rep(0, nrow(DM)),
rnorm(n = nrow(DM) * 4)
),
VISIT = factor(rep(paste0("V", 0:4), each = nrow(DM)))
) |>
dplyr::inner_join(DM, by = "ID")
basic_table() |>
split_rows_by("VISIT") |>
split_cols_by("ARM") |>
analyze(
vars = "AVAL",
afun = a_summarize_mmrm,
na_str = tern::default_na_str(),
show_labels = "hidden",
extra_args = list(
variables = list(
covariates = c("AGE"),
id = "ID",
arm = "ARM",
visit = "VISIT"
),
conf_level = 0.9,
cor_struct = "toeplitz",
ref_levels = list(VISIT = "V0", ARM = "B: Placebo")
)
) |>
build_table(longdat) |>
prune_table(all_zero)