| tabulate_mmrm | R Documentation |
MMRM ResultsThese functions can be used to produce tables from a fitted MMRM produced with
fit_mmrm().
## S3 method for class 'tern_mmrm'
as.rtable(x, type = c("fixed", "cov", "diagnostic"), ...)
h_mmrm_fixed(x, format = "xx.xxxx")
h_mmrm_cov(x, format = "xx.xxxx")
h_mmrm_diagnostic(x, format = "xx.xxxx")
## S3 method for class 'tern_mmrm'
tidy(x, ...)
s_mmrm_lsmeans(df, .in_ref_col, show_relative = c("reduction", "increase"))
a_mmrm_lsmeans(df, .in_ref_col, show_relative = c("reduction", "increase"))
s_mmrm_lsmeans_single(df)
a_mmrm_lsmeans_single(df)
summarize_lsmeans(
lyt,
arms = TRUE,
...,
table_names = "lsmeans_summary",
.stats = NULL,
.formats = NULL,
.indent_mods = NULL,
.labels = NULL
)
x |
( |
type |
( |
... |
additional argument |
format |
( |
df |
( |
.in_ref_col |
( |
show_relative |
should the "reduction" ( |
lyt |
( |
arms |
( |
table_names |
( |
.stats |
( |
.formats |
(named |
.indent_mods |
(named |
.labels |
(named |
as.rtable.tern_mmrm() returns the fixed effects, covariance estimate or
diagnostic statistics tables.
as.rtable(tern_mmrm): Produce simple MMRM tables via the generic as.rtable().
h_mmrm_fixed(): Helper function to produce fixed effects table.
h_mmrm_cov(): Helper function to produce a covariance matrix table.
h_mmrm_diagnostic(): Helper function to produce a diagnostic statistics table.
tidy(tern_mmrm): Helper method (for broom::tidy()) to prepare a data.frame from an
tern_mmrm object containing the least-squares means and contrasts.
s_mmrm_lsmeans(): Statistics function which is extracting estimates from a tidied least-squares means
data frame.
a_mmrm_lsmeans(): Formatted Analysis function which can be further customized by calling
rtables::make_afun() on it. It is used as afun in rtables::analyze().
s_mmrm_lsmeans_single(): Statistics function which is extracting estimates from a tidied least-squares means
data frame when ARM is not considered in the model.
a_mmrm_lsmeans_single(): Formatted Analysis function (when ARM is not considered in the model)
which can be further customized by calling
rtables::make_afun() on it. It is used as afun in rtables::analyze().
summarize_lsmeans(): Analyze function for tabulating least-squares means estimates from tidied mmrm results.
result <- fit_mmrm(
vars = list(
response = "FEV1",
covariates = c("RACE", "SEX"),
id = "USUBJID",
arm = "ARMCD",
visit = "AVISIT"
),
data = mmrm_test_data,
cor_struct = "unstructured",
weights_emmeans = "equal"
)
as.rtable(result, type = "cov", format = "xx.x")
result_no_arm <- fit_mmrm(
vars = list(
response = "FEV1",
covariates = c("RACE", "SEX"),
id = "USUBJID",
visit = "AVISIT"
),
data = mmrm_test_data,
cor_struct = "unstructured",
weights_emmeans = "equal"
)
as.rtable(result_no_arm, type = "cov", format = "xx.x")
df <- broom::tidy(result)
df_no_arm <- broom::tidy(result_no_arm)
s_mmrm_lsmeans(df[8, ], .in_ref_col = FALSE)
s_mmrm_lsmeans_single(df_no_arm[4, ])
library(dplyr)
dat_adsl <- mmrm_test_data %>%
select(USUBJID, ARMCD) %>%
unique()
basic_table() %>%
split_cols_by("ARMCD", ref_group = result$ref_level) %>%
add_colcounts() %>%
split_rows_by("AVISIT") %>%
summarize_lsmeans(
.stats = c("n", "adj_mean_se", "adj_mean_ci", "diff_mean_se", "diff_mean_ci"),
.labels = c(adj_mean_se = "Adj. LS Mean (Std. Error)"),
.formats = c(adj_mean_se = sprintf_format("%.1f (%.2f)"))
) %>%
build_table(
df = broom::tidy(result),
alt_counts_df = dat_adsl
)
basic_table() %>%
split_rows_by("AVISIT") %>%
summarize_lsmeans(arms = FALSE) %>%
build_table(
df = broom::tidy(result_no_arm),
alt_counts_df = dat_adsl
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.