This vignette uses the bcva_data
dataset from the mmrm
package to compare a Bayesian MMRM fit, obtained by brms.mmrm::brm_model()
, and a frequentist MMRM fit,
obtained by mmrm::mmrm()
. An overview of parameter estimates and
differences by type of MMRM is given in the summary (Tables 4 and 5)
at the end.
This comparison workflow requires the following packages.
> packages <- c( + "dplyr", + "tidyr", + "ggplot2", + "gt", + "gtsummary", + "purrr", + "parallel", + "brms.mmrm", + "mmrm", + "posterior" + ) > invisible(lapply(packages, library, character.only = TRUE))
We set a seed for the random number generator to ensure statistical reproducibility.
> set.seed(123L)
This analysis exercise uses the bcva_data
dataset contained in the mmrm
package:
> data(bcva_data, package = "mmrm")
According to https://openpharma.github.io/mmrm/latest-tag/articles/mmrm_review_methods.html:
The BCVA dataset contains data from a randomized longitudinal ophthalmology trial evaluating the change in baseline corrected visual acuity (BCVA) over the course of 10 visits. BCVA corresponds to the number of letters read from a visual acuity chart.
The dataset is a tibble
with 8605 rows and the following notable variables.
USUBJID
(subject ID)AVISIT
(visit number, factor)VISITN
(visit number, numeric)ARMCD
(treatment, TRT
or CTL
)RACE
(3-category race)BCVA_BL
(BCVA at baseline)BCVA_CHG
(BCVA change from baseline, primary endpoint for the analysis)The rest of the pre-processing steps create factors for the study arm and visit and apply the usual checking and standardization steps of brms.mmrm::brm_data()
.
> bcva_data <- bcva_data |> + mutate(AVISIT = gsub("VIS0*", "VIS", as.character(AVISIT))) |> + brm_data( + outcome = "BCVA_CHG", + group = "ARMCD", + time = "AVISIT", + patient = "USUBJID", + baseline = "BCVA_BL", + reference_group = "CTL", + covariates = "RACE" + ) |> + brm_data_chronologize(order = "VISITN")
The following table shows the first rows of the dataset.
> head(bcva_data) |> + gt() |> + tab_caption(caption = md("Table 1. First rows of the pre-processed `bcva_data` dataset."))
USUBJID | AVISIT | VISITN | ARMCD | RACE | BCVA_BL | BCVA_CHG |
---|---|---|---|---|---|---|
3 | VIS1 | 1 | CTL | Asian | 71.70881 | 5.058546 |
3 | VIS10 | 10 | CTL | Asian | 71.70881 | 10.152565 |
3 | VIS2 | 2 | CTL | Asian | 71.70881 | 4.018582 |
3 | VIS3 | 3 | CTL | Asian | 71.70881 | 3.572535 |
3 | VIS4 | 4 | CTL | Asian | 71.70881 | 4.822669 |
3 | VIS5 | 5 | CTL | Asian | 71.70881 | 7.348768 |
Table of baseline characteristics:
```{.r .fold-hide}
bcva_data |> + select(ARMCD, USUBJID, RACE, BCVA_BL) |> + distinct() |> + select(-USUBJID) |> + tbl_summary( + by = c(ARMCD), + statistic = list( + all_continuous() ~ "{mean} ({sd})", + all_categorical() ~ "{n} / {N} ({p}%)" + ) + ) |> + modify_caption("Table 2. Baseline characteristics.")
<!--html_preserve--><div id="zesyyichzg" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;"> <style>#zesyyichzg table { font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #zesyyichzg thead, #zesyyichzg tbody, #zesyyichzg tfoot, #zesyyichzg tr, #zesyyichzg td, #zesyyichzg th { border-style: none; } #zesyyichzg p { margin: 0; padding: 0; } #zesyyichzg .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #zesyyichzg .gt_caption { padding-top: 4px; padding-bottom: 4px; } #zesyyichzg .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #zesyyichzg .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #zesyyichzg .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #zesyyichzg .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #zesyyichzg .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #zesyyichzg .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #zesyyichzg .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #zesyyichzg .gt_column_spanner_outer:first-child { padding-left: 0; } #zesyyichzg .gt_column_spanner_outer:last-child { padding-right: 0; } #zesyyichzg .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #zesyyichzg .gt_spanner_row { border-bottom-style: hidden; } #zesyyichzg .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #zesyyichzg .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #zesyyichzg .gt_from_md > :first-child { margin-top: 0; } #zesyyichzg .gt_from_md > :last-child { margin-bottom: 0; } #zesyyichzg .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #zesyyichzg .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #zesyyichzg .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #zesyyichzg .gt_row_group_first td { border-top-width: 2px; } #zesyyichzg .gt_row_group_first th { border-top-width: 2px; } #zesyyichzg .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #zesyyichzg .gt_first_summary_row { border-top-style: solid; border-top-color: #D3D3D3; } #zesyyichzg .gt_first_summary_row.thick { border-top-width: 2px; } #zesyyichzg .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #zesyyichzg .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #zesyyichzg .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; } #zesyyichzg .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #zesyyichzg .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #zesyyichzg .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #zesyyichzg .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #zesyyichzg .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #zesyyichzg .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #zesyyichzg .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #zesyyichzg .gt_left { text-align: left; } #zesyyichzg .gt_center { text-align: center; } #zesyyichzg .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #zesyyichzg .gt_font_normal { font-weight: normal; } #zesyyichzg .gt_font_bold { font-weight: bold; } #zesyyichzg .gt_font_italic { font-style: italic; } #zesyyichzg .gt_super { font-size: 65%; } #zesyyichzg .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #zesyyichzg .gt_asterisk { font-size: 100%; vertical-align: 0; } #zesyyichzg .gt_indent_1 { text-indent: 5px; } #zesyyichzg .gt_indent_2 { text-indent: 10px; } #zesyyichzg .gt_indent_3 { text-indent: 15px; } #zesyyichzg .gt_indent_4 { text-indent: 20px; } #zesyyichzg .gt_indent_5 { text-indent: 25px; } </style> <table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false"> <!--/html_preserve--><caption class='gt_caption'>Table 2. Baseline characteristics.</caption><!--html_preserve--> <thead> <tr class="gt_col_headings"> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="<strong>Characteristic</strong>"><strong>Characteristic</strong></th> <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="<strong>CTL</strong><br /> N = 494<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;"><sup>1</sup></span>"><strong>CTL</strong><br /> N = 494<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;"><sup>1</sup></span></th> <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="<strong>TRT</strong><br /> N = 506<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;"><sup>1</sup></span>"><strong>TRT</strong><br /> N = 506<span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;"><sup>1</sup></span></th> </tr> </thead> <tbody class="gt_table_body"> <tr><td headers="label" class="gt_row gt_left">RACE</td> <td headers="stat_1" class="gt_row gt_center"><br /></td> <td headers="stat_2" class="gt_row gt_center"><br /></td></tr> <tr><td headers="label" class="gt_row gt_left"> Asian</td> <td headers="stat_1" class="gt_row gt_center">151 / 494 (31%)</td> <td headers="stat_2" class="gt_row gt_center">146 / 506 (29%)</td></tr> <tr><td headers="label" class="gt_row gt_left"> Black</td> <td headers="stat_1" class="gt_row gt_center">149 / 494 (30%)</td> <td headers="stat_2" class="gt_row gt_center">168 / 506 (33%)</td></tr> <tr><td headers="label" class="gt_row gt_left"> White</td> <td headers="stat_1" class="gt_row gt_center">194 / 494 (39%)</td> <td headers="stat_2" class="gt_row gt_center">192 / 506 (38%)</td></tr> <tr><td headers="label" class="gt_row gt_left">BCVA_BL</td> <td headers="stat_1" class="gt_row gt_center">75 (10)</td> <td headers="stat_2" class="gt_row gt_center">75 (10)</td></tr> </tbody> <tfoot class="gt_footnotes"> <tr> <td class="gt_footnote" colspan="3"><span class="gt_footnote_marks" style="white-space:nowrap;font-style:italic;font-weight:normal;"><sup>1</sup></span> n / N (%); Mean (SD)</td> </tr> </tfoot> </table> </div><!--/html_preserve--> Table of change from baseline in BCVA over 52 weeks: ```{.r .fold-hide} > bcva_data |> + pull(AVISIT) |> + unique() |> + sort() |> + purrr::map( + .f = ~ bcva_data |> + filter(AVISIT %in% .x) |> + tbl_summary( + by = ARMCD, + include = BCVA_CHG, + type = BCVA_CHG ~ "continuous2", + statistic = BCVA_CHG ~ c( + "{mean} ({sd})", + "{median} ({p25}, {p75})", + "{min}, {max}" + ), + label = list(BCVA_CHG = paste("Visit ", .x)) + ) + ) |> + tbl_stack(quiet = TRUE) |> + modify_caption("Table 3. Change from baseline.")
Characteristic | CTL N = 494 |
TRT N = 506 |
---|---|---|
Visit VIS1 | ||
Mean (SD) | 5.32 (1.23) | 5.86 (1.33) |
Median (Q1, Q3) | 5.34 (4.51, 6.17) | 5.86 (4.98, 6.81) |
Min, Max | 1.83, 9.02 | 2.28, 10.30 |
Unknown | 12 | 5 |
Visit VIS2 | ||
Mean (SD) | 5.59 (1.49) | 6.33 (1.45) |
Median (Q1, Q3) | 5.53 (4.64, 6.47) | 6.36 (5.34, 7.31) |
Min, Max | 0.29, 10.15 | 2.35, 10.75 |
Unknown | 13 | 7 |
Visit VIS3 | ||
Mean (SD) | 5.79 (1.61) | 6.79 (1.71) |
Median (Q1, Q3) | 5.73 (4.64, 6.91) | 6.82 (5.66, 7.93) |
Min, Max | 1.53, 11.46 | 1.13, 11.49 |
Unknown | 23 | 17 |
Visit VIS4 | ||
Mean (SD) | 6.18 (1.73) | 7.29 (1.82) |
Median (Q1, Q3) | 6.14 (5.05, 7.41) | 7.24 (6.05, 8.54) |
Min, Max | 0.45, 11.49 | 2.07, 11.47 |
Unknown | 36 | 18 |
Visit VIS5 | ||
Mean (SD) | 6.28 (1.97) | 7.68 (1.94) |
Median (Q1, Q3) | 6.18 (4.96, 7.71) | 7.75 (6.48, 8.95) |
Min, Max | 0.87, 11.53 | 2.24, 14.10 |
Unknown | 40 | 35 |
Visit VIS6 | ||
Mean (SD) | 6.69 (1.97) | 8.31 (1.98) |
Median (Q1, Q3) | 6.64 (5.26, 8.14) | 8.29 (6.92, 9.74) |
Min, Max | 1.35, 12.95 | 1.93, 14.38 |
Unknown | 84 | 48 |
Visit VIS7 | ||
Mean (SD) | 6.78 (2.09) | 8.78 (2.11) |
Median (Q1, Q3) | 6.91 (5.46, 8.29) | 8.67 (7.44, 10.26) |
Min, Max | -1.54, 11.99 | 3.21, 14.36 |
Unknown | 106 | 78 |
Visit VIS8 | ||
Mean (SD) | 7.08 (2.25) | 9.40 (2.26) |
Median (Q1, Q3) | 7.08 (5.55, 8.68) | 9.35 (7.96, 10.86) |
Min, Max | 0.97, 13.71 | 2.28, 15.95 |
Unknown | 123 | 86 |
Visit VIS9 | ||
Mean (SD) | 7.39 (2.33) | 10.01 (2.50) |
Median (Q1, Q3) | 7.47 (5.76, 9.05) | 10.01 (8.19, 11.74) |
Min, Max | 0.04, 14.61 | 4.22, 18.09 |
Unknown | 167 | 114 |
Visit VIS10 | ||
Mean (SD) | 7.49 (2.58) | 10.59 (2.36) |
Median (Q1, Q3) | 7.40 (5.73, 9.01) | 10.71 (9.03, 12.25) |
Min, Max | -0.08, 15.75 | 3.24, 16.40 |
Unknown | 213 | 170 |
The following figure shows the primary endpoint over the four study visits in the data.
> bcva_data |> + group_by(ARMCD) |> + ggplot(aes(x = AVISIT, y = BCVA_CHG, fill = factor(ARMCD))) + + geom_hline(yintercept = 0, col = "grey", linewidth = 1.2) + + geom_boxplot(na.rm = TRUE) + + labs( + x = "Visit", + y = "Change from baseline in BCVA", + fill = "Treatment" + ) + + scale_fill_manual(values = c("darkgoldenrod2", "coral2")) + + theme_bw()
Figure 1. Change from baseline in BCVA over 4 visit time points.
The formula for the Bayesian model includes additive effects for baseline, study visit, race, and study-arm-by-visit interaction.
```{.r .fold-hide}
b_mmrm_formula <- brm_formula( + data = bcva_data, + intercept = TRUE, + baseline = TRUE, + group = FALSE, + time = TRUE, + baseline_time = FALSE, + group_time = TRUE, + correlation = "unstructured" + ) print(b_mmrm_formula)
We fit the model using `brms.mmrm::brm_model()`. The computation takes several minutes because of the size of the dataset. To ensure a good basis of comparison with the frequentist model, we put an extremely diffuse prior on the intercept. The parameters already have diffuse flexible priors by default. ```{.r .fold-hide} > b_mmrm_fit <- brm_model( + data = filter(bcva_data, !is.na(BCVA_CHG)), + formula = b_mmrm_formula, + prior = brms::prior(class = "Intercept", prior = "student_t(3, 0, 1000)"), + iter = 10000, + warmup = 2000, + chains = 4, + cores = 4, + seed = 1, + refresh = 0 + )
Here is a posterior summary of model parameters, including fixed effects and pairwise correlation among visits within patients.
```{.r .fold-hide}
summary(b_mmrm_fit)
## Frequentist model The formula for the frequentist model is the same, except for the different syntax for specifying the covariance structure of the MMRM. We fit the model below. ```{.r .fold-hide} > f_mmrm_fit <- mmrm::mmrm( + formula = BCVA_CHG ~ BCVA_BL + ARMCD:AVISIT + AVISIT + RACE + + us(AVISIT | USUBJID), + data = mutate( + bcva_data, + AVISIT = factor(as.character(AVISIT), ordered = FALSE) + ) + )
The parameter summaries of the frequentist model are below.
```{.r .fold-hide}
summary(f_mmrm_fit)
# Comparison This section compares the Bayesian posterior parameter estimates from `brms.mmrm` to the frequentist parameter estimates of the `mmrm` package. ## Extract estimates from Bayesian model We extract and standardize the Bayesian estimates. ```{.r .fold-hide} > b_mmrm_draws <- b_mmrm_fit |> + as_draws_df() > visit_levels <- sort(unique(as.character(bcva_data$AVISIT))) > for (level in visit_levels) { + name <- paste0("b_sigma_AVISIT", level) + b_mmrm_draws[[name]] <- exp(b_mmrm_draws[[name]]) + } > b_mmrm_summary <- b_mmrm_draws |> + summarize_draws() |> + select(variable, mean, sd) |> + filter(!(variable %in% c("Intercept", "lprior", "lp__"))) |> + rename(bayes_estimate = mean, bayes_se = sd) |> + mutate( + variable = variable |> + tolower() |> + gsub(pattern = "b_", replacement = "") |> + gsub(pattern = "b_sigma_AVISIT", replacement = "sigma_") |> + gsub(pattern = "cortime", replacement = "correlation") |> + gsub(pattern = "__", replacement = "_") |> + gsub(pattern = "avisitvis", replacement = "avisit") + )
We extract and standardize the frequentist estimates.
```{.r .fold-hide}
f_mmrm_fixed <- summary(f_mmrm_fit)$coefficients |> + as_tibble(rownames = "variable") |> + mutate(variable = tolower(variable)) |> + mutate(variable = gsub("(", "", variable, fixed = TRUE)) |> + mutate(variable = gsub(")", "", variable, fixed = TRUE)) |> + mutate(variable = gsub("avisitvis", "avisit", variable)) |> + rename(freq_estimate = Estimate, freq_se =
Std. Error
) |> + select(variable, freq_estimate, freq_se)
```{.r .fold-hide} > f_mmrm_variance <- tibble( + variable = paste0("sigma_AVISIT", visit_levels) |> + tolower() |> + gsub(pattern = "avisitvis", replacement = "avisit"), + freq_estimate = sqrt(diag(f_mmrm_fit$cov)) + )
```{.r .fold-hide}
f_diagonal_factor <- diag(1 / sqrt(diag(f_mmrm_fit$cov))) f_corr_matrix <- f_diagonal_factor %% f_mmrm_fit$cov %% f_diagonal_factor colnames(f_corr_matrix) <- visit_levels
```{.r .fold-hide} > f_mmrm_correlation <- f_corr_matrix |> + as.data.frame() |> + as_tibble() |> + mutate(x1 = visit_levels) |> + pivot_longer( + cols = -any_of("x1"), + names_to = "x2", + values_to = "freq_estimate" + ) |> + filter( + as.numeric(gsub("[^0-9]", "", x1)) < as.numeric(gsub("[^0-9]", "", x2)) + ) |> + mutate(variable = sprintf("correlation_%s_%s", x1, x2)) |> + select(variable, freq_estimate)
```{.r .fold-hide}
f_mmrm_summary <- bind_rows( + f_mmrm_fixed, + f_mmrm_variance, + f_mmrm_correlation + ) |> + mutate(variable = gsub("\s+", "", variable) |> tolower())
## Summary {#Summary} The first table below summarizes the parameter estimates from each model and the differences between estimates (Bayesian minus frequentist). The second table shows the standard errors of these estimates and differences between standard errors. In each table, the "Relative" column shows the relative difference (the difference divided by the frequentist quantity). Because of the different statistical paradigms and estimation procedures, especially regarding the covariance parameters, it would not be realistic to expect the Bayesian and frequentist approaches to yield virtually identical results. Nevertheless, the absolute and relative differences in the table below show strong agreement between `brms.mmrm` and `mmrm`. ```{.r .fold-hide} > b_f_comparison <- full_join( + x = b_mmrm_summary, + y = f_mmrm_summary, + by = "variable" + ) |> + mutate( + diff_estimate = bayes_estimate - freq_estimate, + diff_relative_estimate = diff_estimate / freq_estimate, + diff_se = bayes_se - freq_se, + diff_relative_se = diff_se / freq_se + ) |> + select(variable, ends_with("estimate"), ends_with("se"))
```{.r .fold-hide}
table_estimates <- b_f_comparison |> + select(variable, ends_with("estimate")) gt(table_estimates) |> + fmt_number(decimals = 4) |> + tab_caption( + caption = md( + paste( + "Table 4. Comparison of parameter estimates between", + "Bayesian and frequentist MMRMs." + ) + ) + ) |> + cols_label( + variable = "Variable", + bayes_estimate = "Bayesian", + freq_estimate = "Frequentist", + diff_estimate = "Difference", + diff_relative_estimate = "Relative" + )
<!--html_preserve--><div id="hplyncngcw" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;"> <style>#hplyncngcw table { font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #hplyncngcw thead, #hplyncngcw tbody, #hplyncngcw tfoot, #hplyncngcw tr, #hplyncngcw td, #hplyncngcw th { border-style: none; } #hplyncngcw p { margin: 0; padding: 0; } #hplyncngcw .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #hplyncngcw .gt_caption { padding-top: 4px; padding-bottom: 4px; } #hplyncngcw .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #hplyncngcw .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #hplyncngcw .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #hplyncngcw .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #hplyncngcw .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #hplyncngcw .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #hplyncngcw .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #hplyncngcw .gt_column_spanner_outer:first-child { padding-left: 0; } #hplyncngcw .gt_column_spanner_outer:last-child { padding-right: 0; } #hplyncngcw .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #hplyncngcw .gt_spanner_row { border-bottom-style: hidden; } #hplyncngcw .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #hplyncngcw .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #hplyncngcw .gt_from_md > :first-child { margin-top: 0; } #hplyncngcw .gt_from_md > :last-child { margin-bottom: 0; } #hplyncngcw .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #hplyncngcw .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #hplyncngcw .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #hplyncngcw .gt_row_group_first td { border-top-width: 2px; } #hplyncngcw .gt_row_group_first th { border-top-width: 2px; } #hplyncngcw .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #hplyncngcw .gt_first_summary_row { border-top-style: solid; border-top-color: #D3D3D3; } #hplyncngcw .gt_first_summary_row.thick { border-top-width: 2px; } #hplyncngcw .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #hplyncngcw .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #hplyncngcw .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; } #hplyncngcw .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #hplyncngcw .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #hplyncngcw .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #hplyncngcw .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #hplyncngcw .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #hplyncngcw .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #hplyncngcw .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #hplyncngcw .gt_left { text-align: left; } #hplyncngcw .gt_center { text-align: center; } #hplyncngcw .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #hplyncngcw .gt_font_normal { font-weight: normal; } #hplyncngcw .gt_font_bold { font-weight: bold; } #hplyncngcw .gt_font_italic { font-style: italic; } #hplyncngcw .gt_super { font-size: 65%; } #hplyncngcw .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #hplyncngcw .gt_asterisk { font-size: 100%; vertical-align: 0; } #hplyncngcw .gt_indent_1 { text-indent: 5px; } #hplyncngcw .gt_indent_2 { text-indent: 10px; } #hplyncngcw .gt_indent_3 { text-indent: 15px; } #hplyncngcw .gt_indent_4 { text-indent: 20px; } #hplyncngcw .gt_indent_5 { text-indent: 25px; } </style> <table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false"> <!--/html_preserve--><caption class='gt_caption'>Table 4. Comparison of parameter estimates between Bayesian and frequentist MMRMs.</caption><!--html_preserve--> <thead> <tr class="gt_col_headings"> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="Variable">Variable</th> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="Bayesian">Bayesian</th> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="Frequentist">Frequentist</th> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="Difference">Difference</th> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="Relative">Relative</th> </tr> </thead> <tbody class="gt_table_body"> <tr><td headers="variable" class="gt_row gt_left">intercept</td> <td headers="bayes_estimate" class="gt_row gt_right">4.2889</td> <td headers="freq_estimate" class="gt_row gt_right">4.2881</td> <td headers="diff_estimate" class="gt_row gt_right">0.0009</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0002</td></tr> <tr><td headers="variable" class="gt_row gt_left">bcva_bl</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0010</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0010</td> <td headers="diff_estimate" class="gt_row gt_right">0.0000</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0143</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit2</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2806</td> <td headers="freq_estimate" class="gt_row gt_right">0.2810</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0004</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0014</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit3</td> <td headers="bayes_estimate" class="gt_row gt_right">0.4577</td> <td headers="freq_estimate" class="gt_row gt_right">0.4573</td> <td headers="diff_estimate" class="gt_row gt_right">0.0005</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0010</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit4</td> <td headers="bayes_estimate" class="gt_row gt_right">0.8564</td> <td headers="freq_estimate" class="gt_row gt_right">0.8570</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0005</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0006</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit5</td> <td headers="bayes_estimate" class="gt_row gt_right">0.9631</td> <td headers="freq_estimate" class="gt_row gt_right">0.9638</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0007</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0007</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit6</td> <td headers="bayes_estimate" class="gt_row gt_right">1.3333</td> <td headers="freq_estimate" class="gt_row gt_right">1.3339</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0006</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0005</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit7</td> <td headers="bayes_estimate" class="gt_row gt_right">1.4161</td> <td headers="freq_estimate" class="gt_row gt_right">1.4167</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0006</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0005</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit8</td> <td headers="bayes_estimate" class="gt_row gt_right">1.7106</td> <td headers="freq_estimate" class="gt_row gt_right">1.7107</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0001</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0001</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit9</td> <td headers="bayes_estimate" class="gt_row gt_right">1.9955</td> <td headers="freq_estimate" class="gt_row gt_right">1.9956</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0001</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0000</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit10</td> <td headers="bayes_estimate" class="gt_row gt_right">2.0997</td> <td headers="freq_estimate" class="gt_row gt_right">2.1005</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0008</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0004</td></tr> <tr><td headers="variable" class="gt_row gt_left">raceblack</td> <td headers="bayes_estimate" class="gt_row gt_right">1.0385</td> <td headers="freq_estimate" class="gt_row gt_right">1.0382</td> <td headers="diff_estimate" class="gt_row gt_right">0.0002</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0002</td></tr> <tr><td headers="variable" class="gt_row gt_left">racewhite</td> <td headers="bayes_estimate" class="gt_row gt_right">2.0054</td> <td headers="freq_estimate" class="gt_row gt_right">2.0051</td> <td headers="diff_estimate" class="gt_row gt_right">0.0003</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0002</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit1:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">0.5391</td> <td headers="freq_estimate" class="gt_row gt_right">0.5391</td> <td headers="diff_estimate" class="gt_row gt_right">0.0000</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0001</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit2:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">0.7249</td> <td headers="freq_estimate" class="gt_row gt_right">0.7248</td> <td headers="diff_estimate" class="gt_row gt_right">0.0001</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0001</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit3:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">1.0110</td> <td headers="freq_estimate" class="gt_row gt_right">1.0115</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0005</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0005</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit4:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">1.1049</td> <td headers="freq_estimate" class="gt_row gt_right">1.1042</td> <td headers="diff_estimate" class="gt_row gt_right">0.0007</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0007</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit5:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">1.3843</td> <td headers="freq_estimate" class="gt_row gt_right">1.3834</td> <td headers="diff_estimate" class="gt_row gt_right">0.0009</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0007</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit6:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">1.6304</td> <td headers="freq_estimate" class="gt_row gt_right">1.6301</td> <td headers="diff_estimate" class="gt_row gt_right">0.0003</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0002</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit7:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">2.0168</td> <td headers="freq_estimate" class="gt_row gt_right">2.0160</td> <td headers="diff_estimate" class="gt_row gt_right">0.0009</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0004</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit8:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">2.3471</td> <td headers="freq_estimate" class="gt_row gt_right">2.3469</td> <td headers="diff_estimate" class="gt_row gt_right">0.0002</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0001</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit9:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">2.6592</td> <td headers="freq_estimate" class="gt_row gt_right">2.6585</td> <td headers="diff_estimate" class="gt_row gt_right">0.0007</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0003</td></tr> <tr><td headers="variable" class="gt_row gt_left">avisit10:armcdtrt</td> <td headers="bayes_estimate" class="gt_row gt_right">3.0742</td> <td headers="freq_estimate" class="gt_row gt_right">3.0723</td> <td headers="diff_estimate" class="gt_row gt_right">0.0019</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0006</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit1</td> <td headers="bayes_estimate" class="gt_row gt_right">0.9893</td> <td headers="freq_estimate" class="gt_row gt_right">0.9855</td> <td headers="diff_estimate" class="gt_row gt_right">0.0037</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0038</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit2</td> <td headers="bayes_estimate" class="gt_row gt_right">1.2557</td> <td headers="freq_estimate" class="gt_row gt_right">1.2497</td> <td headers="diff_estimate" class="gt_row gt_right">0.0060</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0048</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit3</td> <td headers="bayes_estimate" class="gt_row gt_right">1.4289</td> <td headers="freq_estimate" class="gt_row gt_right">1.4220</td> <td headers="diff_estimate" class="gt_row gt_right">0.0069</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0048</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit4</td> <td headers="bayes_estimate" class="gt_row gt_right">1.5568</td> <td headers="freq_estimate" class="gt_row gt_right">1.5528</td> <td headers="diff_estimate" class="gt_row gt_right">0.0040</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0026</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit5</td> <td headers="bayes_estimate" class="gt_row gt_right">1.7633</td> <td headers="freq_estimate" class="gt_row gt_right">1.7583</td> <td headers="diff_estimate" class="gt_row gt_right">0.0050</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0028</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit6</td> <td headers="bayes_estimate" class="gt_row gt_right">1.7888</td> <td headers="freq_estimate" class="gt_row gt_right">1.7847</td> <td headers="diff_estimate" class="gt_row gt_right">0.0041</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0023</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit7</td> <td headers="bayes_estimate" class="gt_row gt_right">1.9931</td> <td headers="freq_estimate" class="gt_row gt_right">1.9817</td> <td headers="diff_estimate" class="gt_row gt_right">0.0113</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0057</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit8</td> <td headers="bayes_estimate" class="gt_row gt_right">2.0922</td> <td headers="freq_estimate" class="gt_row gt_right">2.0802</td> <td headers="diff_estimate" class="gt_row gt_right">0.0120</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0058</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit9</td> <td headers="bayes_estimate" class="gt_row gt_right">2.2208</td> <td headers="freq_estimate" class="gt_row gt_right">2.2053</td> <td headers="diff_estimate" class="gt_row gt_right">0.0155</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0070</td></tr> <tr><td headers="variable" class="gt_row gt_left">sigma_avisit10</td> <td headers="bayes_estimate" class="gt_row gt_right">2.3279</td> <td headers="freq_estimate" class="gt_row gt_right">2.3134</td> <td headers="diff_estimate" class="gt_row gt_right">0.0145</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0063</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis2</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0489</td> <td headers="freq_estimate" class="gt_row gt_right">0.0512</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0023</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0441</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis3</td> <td headers="bayes_estimate" class="gt_row gt_right">0.3084</td> <td headers="freq_estimate" class="gt_row gt_right">0.3119</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0036</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0114</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis3</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0482</td> <td headers="freq_estimate" class="gt_row gt_right">0.0490</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0008</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0164</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis4</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2126</td> <td headers="freq_estimate" class="gt_row gt_right">0.2166</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0040</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0184</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis4</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1351</td> <td headers="freq_estimate" class="gt_row gt_right">0.1383</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0033</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0237</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis4</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0106</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0098</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0008</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0869</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis5</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1722</td> <td headers="freq_estimate" class="gt_row gt_right">0.1764</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0041</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0234</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis5</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1167</td> <td headers="freq_estimate" class="gt_row gt_right">0.1199</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0032</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0265</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis5</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0082</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0076</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0006</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.0849</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis4_vis5</td> <td headers="bayes_estimate" class="gt_row gt_right">0.3770</td> <td headers="freq_estimate" class="gt_row gt_right">0.3836</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0066</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0173</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis6</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2617</td> <td headers="freq_estimate" class="gt_row gt_right">0.2665</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0048</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0181</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis6</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2038</td> <td headers="freq_estimate" class="gt_row gt_right">0.2079</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0040</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0194</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis6</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0422</td> <td headers="freq_estimate" class="gt_row gt_right">0.0434</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0012</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0279</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis4_vis6</td> <td headers="bayes_estimate" class="gt_row gt_right">0.4044</td> <td headers="freq_estimate" class="gt_row gt_right">0.4117</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0073</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0177</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis5_vis6</td> <td headers="bayes_estimate" class="gt_row gt_right">0.3941</td> <td headers="freq_estimate" class="gt_row gt_right">0.4013</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0072</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0179</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis7</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0654</td> <td headers="freq_estimate" class="gt_row gt_right">0.0679</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0024</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0360</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis7</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0857</td> <td headers="freq_estimate" class="gt_row gt_right">0.0880</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0023</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0266</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis7</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0019</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0017</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0002</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.1039</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis4_vis7</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1464</td> <td headers="freq_estimate" class="gt_row gt_right">0.1503</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0040</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0263</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis5_vis7</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1941</td> <td headers="freq_estimate" class="gt_row gt_right">0.1983</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0042</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0214</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis6_vis7</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2083</td> <td headers="freq_estimate" class="gt_row gt_right">0.2132</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0048</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0227</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0478</td> <td headers="freq_estimate" class="gt_row gt_right">0.0497</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0019</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0382</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1044</td> <td headers="freq_estimate" class="gt_row gt_right">0.1068</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0024</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0225</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0332</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0336</td> <td headers="diff_estimate" class="gt_row gt_right">0.0004</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0112</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis4_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1712</td> <td headers="freq_estimate" class="gt_row gt_right">0.1752</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0040</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0229</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis5_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1683</td> <td headers="freq_estimate" class="gt_row gt_right">0.1725</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0041</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0240</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis6_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1597</td> <td headers="freq_estimate" class="gt_row gt_right">0.1641</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0045</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0273</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis7_vis8</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0538</td> <td headers="freq_estimate" class="gt_row gt_right">0.0559</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0022</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0392</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0269</td> <td headers="freq_estimate" class="gt_row gt_right">0.0281</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0012</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0432</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0065</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0056</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0010</td> <td headers="diff_relative_estimate" class="gt_row gt_right">0.1708</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">−0.0416</td> <td headers="freq_estimate" class="gt_row gt_right">−0.0421</td> <td headers="diff_estimate" class="gt_row gt_right">0.0005</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0124</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis4_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1160</td> <td headers="freq_estimate" class="gt_row gt_right">0.1193</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0033</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0273</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis5_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0898</td> <td headers="freq_estimate" class="gt_row gt_right">0.0927</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0029</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0313</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis6_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1692</td> <td headers="freq_estimate" class="gt_row gt_right">0.1733</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0041</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0238</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis7_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0153</td> <td headers="freq_estimate" class="gt_row gt_right">0.0165</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0013</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0761</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis8_vis9</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0569</td> <td headers="freq_estimate" class="gt_row gt_right">0.0585</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0016</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0267</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis1_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0229</td> <td headers="freq_estimate" class="gt_row gt_right">0.0257</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0029</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.1112</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis2_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.1266</td> <td headers="freq_estimate" class="gt_row gt_right">0.1301</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0035</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0267</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis3_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0217</td> <td headers="freq_estimate" class="gt_row gt_right">0.0219</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0002</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0070</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis4_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.3115</td> <td headers="freq_estimate" class="gt_row gt_right">0.3195</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0080</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0251</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis5_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2385</td> <td headers="freq_estimate" class="gt_row gt_right">0.2458</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0073</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0298</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis6_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.2959</td> <td headers="freq_estimate" class="gt_row gt_right">0.3041</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0082</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0271</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis7_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0631</td> <td headers="freq_estimate" class="gt_row gt_right">0.0659</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0028</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0422</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis8_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0932</td> <td headers="freq_estimate" class="gt_row gt_right">0.0968</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0037</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0377</td></tr> <tr><td headers="variable" class="gt_row gt_left">correlation_vis9_vis10</td> <td headers="bayes_estimate" class="gt_row gt_right">0.0781</td> <td headers="freq_estimate" class="gt_row gt_right">0.0812</td> <td headers="diff_estimate" class="gt_row gt_right">−0.0031</td> <td headers="diff_relative_estimate" class="gt_row gt_right">−0.0383</td></tr> </tbody> </table> </div><!--/html_preserve--> ```{.r .fold-hide} > table_se <- b_f_comparison |> + select(variable, ends_with("se")) |> + filter(!is.na(freq_se)) > gt(table_se) |> + fmt_number(decimals = 4) |> + tab_caption( + caption = md( + paste( + "Table 5. Comparison of parameter standard errors between", + "Bayesian and frequentist MMRMs." + ) + ) + ) |> + cols_label( + variable = "Variable", + bayes_se = "Bayesian", + freq_se = "Frequentist", + diff_se = "Difference", + diff_relative_se = "Relative" + )
Variable | Bayesian | Frequentist | Difference | Relative |
---|---|---|---|---|
intercept | 0.1695 | 0.1709 | −0.0015 | −0.0086 |
bcva_bl | 0.0021 | 0.0022 | 0.0000 | −0.0100 |
avisit2 | 0.0709 | 0.0707 | 0.0003 | 0.0038 |
avisit3 | 0.0675 | 0.0672 | 0.0003 | 0.0052 |
avisit4 | 0.0771 | 0.0764 | 0.0007 | 0.0094 |
avisit5 | 0.0868 | 0.0863 | 0.0005 | 0.0055 |
avisit6 | 0.0869 | 0.0865 | 0.0004 | 0.0042 |
avisit7 | 0.1081 | 0.1071 | 0.0011 | 0.0102 |
avisit8 | 0.1147 | 0.1145 | 0.0002 | 0.0017 |
avisit9 | 0.1276 | 0.1283 | −0.0007 | −0.0057 |
avisit10 | 0.1418 | 0.1400 | 0.0018 | 0.0130 |
raceblack | 0.0548 | 0.0550 | −0.0001 | −0.0024 |
racewhite | 0.0518 | 0.0520 | −0.0001 | −0.0029 |
avisit1:armcdtrt | 0.0632 | 0.0628 | 0.0003 | 0.0054 |
avisit2:armcdtrt | 0.0806 | 0.0798 | 0.0007 | 0.0093 |
avisit3:armcdtrt | 0.0925 | 0.0916 | 0.0008 | 0.0092 |
avisit4:armcdtrt | 0.1017 | 0.1004 | 0.0014 | 0.0136 |
avisit5:armcdtrt | 0.1157 | 0.1147 | 0.0010 | 0.0088 |
avisit6:armcdtrt | 0.1189 | 0.1189 | 0.0000 | 0.0003 |
avisit7:armcdtrt | 0.1390 | 0.1382 | 0.0008 | 0.0060 |
avisit8:armcdtrt | 0.1484 | 0.1474 | 0.0010 | 0.0066 |
avisit9:armcdtrt | 0.1643 | 0.1644 | −0.0001 | −0.0004 |
avisit10:armcdtrt | 0.1837 | 0.1815 | 0.0022 | 0.0122 |
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.