mmrm_results <- fit_mmrm(
vars = list(
response = "FEV1",
covariates = "RACE",
id = "USUBJID",
arm = "ARMCD",
visit = "AVISIT"
),
data = mmrm_test_data,
cor_struct = "compound symmetry",
weights_emmeans = "equal",
averages_emmeans = list(
"VIS1+2" = c("VIS1", "VIS2")
)
)
df <- extract_mmrm_subgroups(
fit = mmrm_results,
visit = "VIS3",
subgroups = c("RACE", "SEX")
)
## Table with default columns.
basic_table() %>%
tabulate_mmrm_subgroups(df)
## Table with selected columns.
tab <- basic_table() %>%
tabulate_mmrm_subgroups(
df = df,
vars = c("n_tot", "diff", "ci", "pval")
)
tab
## Forest plot can be produced based on this very easily.
g_forest(tab, logx = FALSE, xlim = c(-10, 10), x_at = c(-10, -5, 0, 5, 10), vline = 0)
Run the code above in your browser using DataLab