---
title: FEV1 data comparison between Bayesian and frequentist MMRMs
date: "2024-09-07"
output:
  rmarkdown::html_document:
    theme: spacelab
    highlight: default
    toc: yes
    toc_float: yes
    number_sections: true 
vignette: >
  %\VignetteIndexEntry{FEV1 data comparison between Bayesian and frequentist MMRMs}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
editor_options:
  chunk_output_type: console
  markdown:
    wrap: 72
---



# About {.unnumbered}

This vignette provides an example comparison of 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)](#Summary) 
at the end.

# Prerequisites

This comparison workflow requires the following packages.


```r
> 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.


```r
> set.seed(123L)
```

# Data

## Pre-processing

This analysis exercise uses the `fev_dat` dataset contained in the `mmrm`-package:


```r
> data(fev_data, package = "mmrm")
```

It is an artificial (simulated) dataset of a clinical trial investigating the 
effect of an active treatment on `FEV1` (forced expired volume in one second),
compared to placebo. `FEV1` is a measure of how quickly the lungs can be 
emptied and low levels may indicate chronic obstructive pulmonary disease 
(COPD). 

The dataset is a `tibble` with 800 rows and the following notable variables:

* `USUBJID` (subject ID)
* `AVISIT` (visit number, factor)
* `VISITN` (visit number, numeric)
* `ARMCD` (treatment, `TRT` or `PBO`)
* `RACE` (3-category race)
* `SEX` (female or male)
* `FEV1_BL` (FEV1 at baseline, %)
* `FEV1` (FEV1 at study visits)
* `WEIGHT` (weighting variable)

The primary endpoint for the analysis is change from baseline in `FEV1`, which we derive below and denote `FEV1_CHG`.


```r
> fev_data <- fev_data |>
+   mutate("FEV1_CHG" = FEV1 - FEV1_BL)
```

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()`.


```r
> fev_data <- brm_data(
+   data = fev_data,
+   outcome = "FEV1_CHG",
+   group = "ARMCD",
+   time = "AVISIT",
+   patient = "USUBJID",
+   baseline = "FEV1_BL",
+   reference_group = "PBO",
+   covariates = c("RACE", "SEX")
+ ) |>
+   brm_data_chronologize(order = "VISITN")
```

The following table shows the first rows of the dataset.


```r
> head(fev_data) |>
+   gt() |>
+   tab_caption(caption = md("Table 1. First rows of the pre-processed `fev_dat` dataset."))
```

<!--html_preserve--><div id="osncjrvket" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#osncjrvket 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;
}

#osncjrvket thead, #osncjrvket tbody, #osncjrvket tfoot, #osncjrvket tr, #osncjrvket td, #osncjrvket th {
  border-style: none;
}

#osncjrvket p {
  margin: 0;
  padding: 0;
}

#osncjrvket .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;
}

#osncjrvket .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#osncjrvket .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#osncjrvket .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%;
}

#osncjrvket .gt_spanner_row {
  border-bottom-style: hidden;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .gt_from_md > :first-child {
  margin-top: 0;
}

#osncjrvket .gt_from_md > :last-child {
  margin-bottom: 0;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .gt_row_group_first td {
  border-top-width: 2px;
}

#osncjrvket .gt_row_group_first th {
  border-top-width: 2px;
}

#osncjrvket .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#osncjrvket .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#osncjrvket .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#osncjrvket .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;
}

#osncjrvket .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#osncjrvket .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;
}

#osncjrvket .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;
}

#osncjrvket .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#osncjrvket .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;
}

#osncjrvket .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#osncjrvket .gt_left {
  text-align: left;
}

#osncjrvket .gt_center {
  text-align: center;
}

#osncjrvket .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#osncjrvket .gt_font_normal {
  font-weight: normal;
}

#osncjrvket .gt_font_bold {
  font-weight: bold;
}

#osncjrvket .gt_font_italic {
  font-style: italic;
}

#osncjrvket .gt_super {
  font-size: 65%;
}

#osncjrvket .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#osncjrvket .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#osncjrvket .gt_indent_1 {
  text-indent: 5px;
}

#osncjrvket .gt_indent_2 {
  text-indent: 10px;
}

#osncjrvket .gt_indent_3 {
  text-indent: 15px;
}

#osncjrvket .gt_indent_4 {
  text-indent: 20px;
}

#osncjrvket .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 1. First rows of the pre-processed <code>fev_dat</code> dataset.</caption><!--html_preserve-->
  <thead>
    <tr class="gt_col_headings">
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="USUBJID">USUBJID</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="AVISIT">AVISIT</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="ARMCD">ARMCD</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="RACE">RACE</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="SEX">SEX</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="FEV1_BL">FEV1_BL</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="FEV1">FEV1</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="WEIGHT">WEIGHT</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="VISITN">VISITN</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="VISITN2">VISITN2</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="FEV1_CHG">FEV1_CHG</th>
    </tr>
  </thead>
  <tbody class="gt_table_body">
    <tr><td headers="USUBJID" class="gt_row gt_center">PT2</td>
<td headers="AVISIT" class="gt_row gt_center">VIS1</td>
<td headers="ARMCD" class="gt_row gt_center">PBO</td>
<td headers="RACE" class="gt_row gt_center">Asian</td>
<td headers="SEX" class="gt_row gt_center">Male</td>
<td headers="FEV1_BL" class="gt_row gt_right">45.02477</td>
<td headers="FEV1" class="gt_row gt_right">NA</td>
<td headers="WEIGHT" class="gt_row gt_right">0.4651848</td>
<td headers="VISITN" class="gt_row gt_right">1</td>
<td headers="VISITN2" class="gt_row gt_right">0.3295078</td>
<td headers="FEV1_CHG" class="gt_row gt_right">NA</td></tr>
    <tr><td headers="USUBJID" class="gt_row gt_center">PT2</td>
<td headers="AVISIT" class="gt_row gt_center">VIS2</td>
<td headers="ARMCD" class="gt_row gt_center">PBO</td>
<td headers="RACE" class="gt_row gt_center">Asian</td>
<td headers="SEX" class="gt_row gt_center">Male</td>
<td headers="FEV1_BL" class="gt_row gt_right">45.02477</td>
<td headers="FEV1" class="gt_row gt_right">31.45522</td>
<td headers="WEIGHT" class="gt_row gt_right">0.2330974</td>
<td headers="VISITN" class="gt_row gt_right">2</td>
<td headers="VISITN2" class="gt_row gt_right">-0.8204684</td>
<td headers="FEV1_CHG" class="gt_row gt_right">-13.569552</td></tr>
    <tr><td headers="USUBJID" class="gt_row gt_center">PT2</td>
<td headers="AVISIT" class="gt_row gt_center">VIS3</td>
<td headers="ARMCD" class="gt_row gt_center">PBO</td>
<td headers="RACE" class="gt_row gt_center">Asian</td>
<td headers="SEX" class="gt_row gt_center">Male</td>
<td headers="FEV1_BL" class="gt_row gt_right">45.02477</td>
<td headers="FEV1" class="gt_row gt_right">36.87889</td>
<td headers="WEIGHT" class="gt_row gt_right">0.3600763</td>
<td headers="VISITN" class="gt_row gt_right">3</td>
<td headers="VISITN2" class="gt_row gt_right">0.4874291</td>
<td headers="FEV1_CHG" class="gt_row gt_right">-8.145878</td></tr>
    <tr><td headers="USUBJID" class="gt_row gt_center">PT2</td>
<td headers="AVISIT" class="gt_row gt_center">VIS4</td>
<td headers="ARMCD" class="gt_row gt_center">PBO</td>
<td headers="RACE" class="gt_row gt_center">Asian</td>
<td headers="SEX" class="gt_row gt_center">Male</td>
<td headers="FEV1_BL" class="gt_row gt_right">45.02477</td>
<td headers="FEV1" class="gt_row gt_right">48.80809</td>
<td headers="WEIGHT" class="gt_row gt_right">0.5073795</td>
<td headers="VISITN" class="gt_row gt_right">4</td>
<td headers="VISITN2" class="gt_row gt_right">0.7383247</td>
<td headers="FEV1_CHG" class="gt_row gt_right">3.783324</td></tr>
    <tr><td headers="USUBJID" class="gt_row gt_center">PT3</td>
<td headers="AVISIT" class="gt_row gt_center">VIS1</td>
<td headers="ARMCD" class="gt_row gt_center">PBO</td>
<td headers="RACE" class="gt_row gt_center">Black or African American</td>
<td headers="SEX" class="gt_row gt_center">Female</td>
<td headers="FEV1_BL" class="gt_row gt_right">43.50070</td>
<td headers="FEV1" class="gt_row gt_right">NA</td>
<td headers="WEIGHT" class="gt_row gt_right">0.6821642</td>
<td headers="VISITN" class="gt_row gt_right">1</td>
<td headers="VISITN2" class="gt_row gt_right">0.5757814</td>
<td headers="FEV1_CHG" class="gt_row gt_right">NA</td></tr>
    <tr><td headers="USUBJID" class="gt_row gt_center">PT3</td>
<td headers="AVISIT" class="gt_row gt_center">VIS2</td>
<td headers="ARMCD" class="gt_row gt_center">PBO</td>
<td headers="RACE" class="gt_row gt_center">Black or African American</td>
<td headers="SEX" class="gt_row gt_center">Female</td>
<td headers="FEV1_BL" class="gt_row gt_right">43.50070</td>
<td headers="FEV1" class="gt_row gt_right">35.98699</td>
<td headers="WEIGHT" class="gt_row gt_right">0.8917896</td>
<td headers="VISITN" class="gt_row gt_right">2</td>
<td headers="VISITN2" class="gt_row gt_right">-0.3053884</td>
<td headers="FEV1_CHG" class="gt_row gt_right">-7.513705</td></tr>
  </tbody>
  
  
</table>
</div><!--/html_preserve-->

## Descriptive statistics

Table of baseline characteristics:


```{.r .fold-hide}
> fev_data |>
+   select(ARMCD, USUBJID, SEX, RACE, FEV1_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="&lt;strong&gt;Characteristic&lt;/strong&gt;"><strong>Characteristic</strong></th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="&lt;strong&gt;PBO&lt;/strong&gt;&lt;br /&gt;&#10;N = 105&lt;span class=&quot;gt_footnote_marks&quot; style=&quot;white-space:nowrap;font-style:italic;font-weight:normal;&quot;&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;"><strong>PBO</strong><br />
N = 105<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="&lt;strong&gt;TRT&lt;/strong&gt;&lt;br /&gt;&#10;N = 95&lt;span class=&quot;gt_footnote_marks&quot; style=&quot;white-space:nowrap;font-style:italic;font-weight:normal;&quot;&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;"><strong>TRT</strong><br />
N = 95<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">SEX</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">    Male</td>
<td headers="stat_1" class="gt_row gt_center">50 / 105 (48%)</td>
<td headers="stat_2" class="gt_row gt_center">44 / 95 (46%)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Female</td>
<td headers="stat_1" class="gt_row gt_center">55 / 105 (52%)</td>
<td headers="stat_2" class="gt_row gt_center">51 / 95 (54%)</td></tr>
    <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">38 / 105 (36%)</td>
<td headers="stat_2" class="gt_row gt_center">32 / 95 (34%)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Black or African American</td>
<td headers="stat_1" class="gt_row gt_center">46 / 105 (44%)</td>
<td headers="stat_2" class="gt_row gt_center">29 / 95 (31%)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    White</td>
<td headers="stat_1" class="gt_row gt_center">21 / 105 (20%)</td>
<td headers="stat_2" class="gt_row gt_center">34 / 95 (36%)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">FEV1_BL</td>
<td headers="stat_1" class="gt_row gt_center">40 (9)</td>
<td headers="stat_2" class="gt_row gt_center">40 (9)</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 FEV1 over 52 weeks:


```{.r .fold-hide}
> fev_data |>
+   pull(AVISIT) |>
+   unique() |>
+   sort() |>
+   purrr::map(
+     .f = ~ fev_data |>
+       filter(AVISIT %in% .x) |>
+       tbl_summary(
+         by = ARMCD,
+         include = FEV1_CHG,
+         type = FEV1_CHG ~ "continuous2",
+         statistic = FEV1_CHG ~ c(
+           "{mean} ({sd})",
+           "{median} ({p25}, {p75})",
+           "{min}, {max}"
+         ),
+         label = list(FEV1_CHG = paste("Visit ", .x))
+       )
+   ) |>
+   tbl_stack(quiet = TRUE) |>
+   modify_caption("Table 3. Change from baseline.")
```

<!--html_preserve--><div id="ehlmrayyfu" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#ehlmrayyfu 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;
}

#ehlmrayyfu thead, #ehlmrayyfu tbody, #ehlmrayyfu tfoot, #ehlmrayyfu tr, #ehlmrayyfu td, #ehlmrayyfu th {
  border-style: none;
}

#ehlmrayyfu p {
  margin: 0;
  padding: 0;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#ehlmrayyfu .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#ehlmrayyfu .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%;
}

#ehlmrayyfu .gt_spanner_row {
  border-bottom-style: hidden;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_from_md > :first-child {
  margin-top: 0;
}

#ehlmrayyfu .gt_from_md > :last-child {
  margin-bottom: 0;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_row_group_first td {
  border-top-width: 2px;
}

#ehlmrayyfu .gt_row_group_first th {
  border-top-width: 2px;
}

#ehlmrayyfu .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#ehlmrayyfu .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#ehlmrayyfu .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#ehlmrayyfu .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;
}

#ehlmrayyfu .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#ehlmrayyfu .gt_left {
  text-align: left;
}

#ehlmrayyfu .gt_center {
  text-align: center;
}

#ehlmrayyfu .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#ehlmrayyfu .gt_font_normal {
  font-weight: normal;
}

#ehlmrayyfu .gt_font_bold {
  font-weight: bold;
}

#ehlmrayyfu .gt_font_italic {
  font-style: italic;
}

#ehlmrayyfu .gt_super {
  font-size: 65%;
}

#ehlmrayyfu .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#ehlmrayyfu .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#ehlmrayyfu .gt_indent_1 {
  text-indent: 5px;
}

#ehlmrayyfu .gt_indent_2 {
  text-indent: 10px;
}

#ehlmrayyfu .gt_indent_3 {
  text-indent: 15px;
}

#ehlmrayyfu .gt_indent_4 {
  text-indent: 20px;
}

#ehlmrayyfu .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 3. Change from baseline.</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="&lt;strong&gt;Characteristic&lt;/strong&gt;"><strong>Characteristic</strong></th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="&lt;strong&gt;PBO&lt;/strong&gt;&lt;br /&gt;&#10;N = 105"><strong>PBO</strong><br />
N = 105</th>
      <th class="gt_col_heading gt_columns_bottom_border gt_center" rowspan="1" colspan="1" scope="col" id="&lt;strong&gt;TRT&lt;/strong&gt;&lt;br /&gt;&#10;N = 95"><strong>TRT</strong><br />
N = 95</th>
    </tr>
  </thead>
  <tbody class="gt_table_body">
    <tr><td headers="label" class="gt_row gt_left">Visit  VIS1</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">    Mean (SD)</td>
<td headers="stat_1" class="gt_row gt_center">-8 (9)</td>
<td headers="stat_2" class="gt_row gt_center">-2 (10)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Median (Q1, Q3)</td>
<td headers="stat_1" class="gt_row gt_center">-9 (-16, 0)</td>
<td headers="stat_2" class="gt_row gt_center">-4 (-9, 7)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Min, Max</td>
<td headers="stat_1" class="gt_row gt_center">-26, 12</td>
<td headers="stat_2" class="gt_row gt_center">-24, 20</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Unknown</td>
<td headers="stat_1" class="gt_row gt_center">37</td>
<td headers="stat_2" class="gt_row gt_center">29</td></tr>
    <tr><td headers="label" class="gt_row gt_left">Visit  VIS2</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">    Mean (SD)</td>
<td headers="stat_1" class="gt_row gt_center">-3 (8)</td>
<td headers="stat_2" class="gt_row gt_center">2 (9)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Median (Q1, Q3)</td>
<td headers="stat_1" class="gt_row gt_center">-3 (-10, 1)</td>
<td headers="stat_2" class="gt_row gt_center">2 (-4, 8)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Min, Max</td>
<td headers="stat_1" class="gt_row gt_center">-20, 15</td>
<td headers="stat_2" class="gt_row gt_center">-22, 23</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Unknown</td>
<td headers="stat_1" class="gt_row gt_center">36</td>
<td headers="stat_2" class="gt_row gt_center">24</td></tr>
    <tr><td headers="label" class="gt_row gt_left">Visit  VIS3</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">    Mean (SD)</td>
<td headers="stat_1" class="gt_row gt_center">2 (8)</td>
<td headers="stat_2" class="gt_row gt_center">5 (9)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Median (Q1, Q3)</td>
<td headers="stat_1" class="gt_row gt_center">2 (-2, 8)</td>
<td headers="stat_2" class="gt_row gt_center">6 (0, 11)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Min, Max</td>
<td headers="stat_1" class="gt_row gt_center">-15, 20</td>
<td headers="stat_2" class="gt_row gt_center">-19, 30</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Unknown</td>
<td headers="stat_1" class="gt_row gt_center">34</td>
<td headers="stat_2" class="gt_row gt_center">37</td></tr>
    <tr><td headers="label" class="gt_row gt_left">Visit  VIS4</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">    Mean (SD)</td>
<td headers="stat_1" class="gt_row gt_center">8 (12)</td>
<td headers="stat_2" class="gt_row gt_center">13 (13)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Median (Q1, Q3)</td>
<td headers="stat_1" class="gt_row gt_center">6 (1, 20)</td>
<td headers="stat_2" class="gt_row gt_center">12 (5, 23)</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Min, Max</td>
<td headers="stat_1" class="gt_row gt_center">-20, 39</td>
<td headers="stat_2" class="gt_row gt_center">-14, 47</td></tr>
    <tr><td headers="label" class="gt_row gt_left">    Unknown</td>
<td headers="stat_1" class="gt_row gt_center">38</td>
<td headers="stat_2" class="gt_row gt_center">28</td></tr>
  </tbody>
  
  
</table>
</div><!--/html_preserve-->

The following figure shows the primary endpoint over the four study visits in the data.


```r
> fev_data |>
+   group_by(ARMCD) |>
+   ggplot(aes(x = AVISIT, y = FEV1_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 FEV1",
+     fill = "Treatment"
+   ) +
+   scale_fill_manual(values = c("darkgoldenrod2", "coral2")) +
+   theme_bw()
```

<div class="figure" style="text-align: center">
<img src="fev1_figures/descr_3-1.png" alt="Figure 1. Change from baseline in FEV1 over 4 visit time points." width="75%" />
<p class="caption">Figure 1. Change from baseline in FEV1 over 4 visit time points.</p>
</div>

# Fitting MMRMs

## Bayesian model

The formula for the Bayesian model includes additive effects for baseline, study visit, race, sex, and study-arm-by-visit interaction.


```{.r .fold-hide}
> b_mmrm_formula <- brm_formula(
+   data = fev_data,
+   intercept = TRUE,
+   baseline = TRUE,
+   group = FALSE,
+   time = TRUE,
+   baseline_time = FALSE,
+   group_time = TRUE,
+   correlation = "unstructured"
+ )
> print(b_mmrm_formula)
#> FEV1_CHG ~ FEV1_BL + ARMCD:AVISIT + AVISIT + RACE + SEX + unstr(time = AVISIT, gr = USUBJID) 
#> sigma ~ 0 + AVISIT
```

We fit the model using `brms.mmrm::brm_model()`. 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(fev_data, !is.na(FEV1_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)
#>  Family: gaussian 
#>   Links: mu = identity; sigma = log 
#> Formula: FEV1_CHG ~ FEV1_BL + ARMCD:AVISIT + AVISIT + RACE + SEX + unstr(time = AVISIT, gr = USUBJID) 
#>          sigma ~ 0 + AVISIT
#>    Data: data[!is.na(data[[attr(data, "brm_outcome")]]), ] (Number of observations: 537) 
#>   Draws: 4 chains, each with iter = 10000; warmup = 2000; thin = 1;
#>          total post-warmup draws = 32000
#> 
#> Correlation Structures:
#>                    Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> cortime(VIS1,VIS2)     0.36      0.08     0.18     0.52 1.00    48758    26086
#> cortime(VIS1,VIS3)     0.14      0.10    -0.05     0.33 1.00    49018    26172
#> cortime(VIS2,VIS3)     0.04      0.10    -0.16     0.23 1.00    49178    25472
#> cortime(VIS1,VIS4)     0.17      0.11    -0.06     0.38 1.00    49528    25555
#> cortime(VIS2,VIS4)     0.11      0.09    -0.07     0.28 1.00    49509    24007
#> cortime(VIS3,VIS4)     0.01      0.10    -0.18     0.21 1.00    45294    24353
#> 
#> Regression Coefficients:
#>                            Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
#> Intercept                     24.34      1.41    21.60    27.09 1.00    43678
#> FEV1_BL                       -0.84      0.03    -0.89    -0.78 1.00    56286
#> AVISIT2                        4.80      0.82     3.20     6.40 1.00    31792
#> AVISIT3                       10.37      0.83     8.73    12.01 1.00    29808
#> AVISIT4                       15.20      1.33    12.60    17.83 1.00    35293
#> RACEBlackorAfricanAmerican     1.41      0.59     0.27     2.55 1.00    46945
#> RACEWhite                      5.46      0.63     4.23     6.69 1.00    47801
#> SEXFemale                      0.35      0.51    -0.64     1.36 1.00    49193
#> AVISITVIS1:ARMCDTRT            3.98      1.07     1.89     6.06 1.00    31646
#> AVISITVIS2:ARMCDTRT            3.93      0.83     2.31     5.55 1.00    46665
#> AVISITVIS3:ARMCDTRT            2.98      0.68     1.65     4.31 1.00    52457
#> AVISITVIS4:ARMCDTRT            4.41      1.68     1.06     7.71 1.00    45307
#> sigma_AVISITVIS1               1.83      0.06     1.71     1.95 1.00    50344
#> sigma_AVISITVIS2               1.59      0.06     1.47     1.71 1.00    48248
#> sigma_AVISITVIS3               1.33      0.06     1.21     1.46 1.00    48058
#> sigma_AVISITVIS4               2.28      0.06     2.16     2.41 1.00    51078
#>                            Tail_ESS
#> Intercept                     25394
#> FEV1_BL                       24494
#> AVISIT2                       24396
#> AVISIT3                       24188
#> AVISIT4                       24810
#> RACEBlackorAfricanAmerican    25405
#> RACEWhite                     23816
#> SEXFemale                     24919
#> AVISITVIS1:ARMCDTRT           26255
#> AVISITVIS2:ARMCDTRT           23809
#> AVISITVIS3:ARMCDTRT           24705
#> AVISITVIS4:ARMCDTRT           25026
#> sigma_AVISITVIS1              26156
#> sigma_AVISITVIS2              24526
#> sigma_AVISITVIS3              24328
#> sigma_AVISITVIS4              23975
#> 
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
```

## 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 = FEV1_CHG ~ FEV1_BL + ARMCD:AVISIT + AVISIT + RACE + SEX +
+     us(AVISIT | USUBJID),
+   data = mutate(
+     fev_data,
+     AVISIT = factor(as.character(AVISIT), ordered = FALSE)
+   )
+ )
```

The parameter summaries of the frequentist model are below.


```{.r .fold-hide}
> summary(f_mmrm_fit)
#> mmrm fit
#> 
#> Formula:     
#> FEV1_CHG ~ FEV1_BL + ARMCD:AVISIT + AVISIT + RACE + SEX + us(AVISIT |  
#>     USUBJID)
#> Data:        
#> mutate(fev_data, AVISIT = factor(as.character(AVISIT), ordered = FALSE)) (used 
#> 537 observations from 197 subjects with maximum 4 timepoints)
#> Covariance:  unstructured (10 variance parameters)
#> Method:      Satterthwaite
#> Vcov Method: Asymptotic
#> Inference:   REML
#> 
#> Model selection criteria:
#>      AIC      BIC   logLik deviance 
#>   3381.4   3414.2  -1680.7   3361.4 
#> 
#> Coefficients: 
#>                                Estimate Std. Error        df t value Pr(>|t|)
#> (Intercept)                    24.35372    1.40754 257.97000  17.302  < 2e-16
#> FEV1_BL                        -0.84022    0.02777 190.27000 -30.251  < 2e-16
#> AVISITVIS2                      4.79036    0.79848 144.82000   5.999 1.51e-08
#> AVISITVIS3                     10.36601    0.81318 157.08000  12.748  < 2e-16
#> AVISITVIS4                     15.19231    1.30857 139.25000  11.610  < 2e-16
#> RACEBlack or African American   1.41921    0.57874 169.56000   2.452 0.015211
#> RACEWhite                       5.45679    0.61626 157.54000   8.855 1.65e-15
#> SEXFemale                       0.33812    0.49273 166.43000   0.686 0.493529
#> AVISITVIS1:ARMCDTRT             3.98329    1.04540 142.32000   3.810 0.000206
#> AVISITVIS2:ARMCDTRT             3.93076    0.81351 142.26000   4.832 3.46e-06
#> AVISITVIS3:ARMCDTRT             2.98372    0.66567 129.61000   4.482 1.61e-05
#> AVISITVIS4:ARMCDTRT             4.40400    1.66049 132.88000   2.652 0.008970
#>                                  
#> (Intercept)                   ***
#> FEV1_BL                       ***
#> AVISITVIS2                    ***
#> AVISITVIS3                    ***
#> AVISITVIS4                    ***
#> RACEBlack or African American *  
#> RACEWhite                     ***
#> SEXFemale                        
#> AVISITVIS1:ARMCDTRT           ***
#> AVISITVIS2:ARMCDTRT           ***
#> AVISITVIS3:ARMCDTRT           ***
#> AVISITVIS4:ARMCDTRT           ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Covariance estimate:
#>         VIS1    VIS2    VIS3    VIS4
#> VIS1 37.8301 11.3255  3.4796 10.6844
#> VIS2 11.3255 23.5476  0.7760  5.5103
#> VIS3  3.4796  0.7760 13.8037  0.5683
#> VIS4 10.6844  5.5103  0.5683 92.9625
```

# 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(fev_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")
+   )
```

## Extract estimates from frequentist model

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">24.3351</td>
<td headers="freq_estimate" class="gt_row gt_right">24.3537</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0186</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0008</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">fev1_bl</td>
<td headers="bayes_estimate" class="gt_row gt_right">−0.8399</td>
<td headers="freq_estimate" class="gt_row gt_right">−0.8402</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0003</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0004</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit2</td>
<td headers="bayes_estimate" class="gt_row gt_right">4.7996</td>
<td headers="freq_estimate" class="gt_row gt_right">4.7904</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0093</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0019</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit3</td>
<td headers="bayes_estimate" class="gt_row gt_right">10.3730</td>
<td headers="freq_estimate" class="gt_row gt_right">10.3660</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0070</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0007</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit4</td>
<td headers="bayes_estimate" class="gt_row gt_right">15.1989</td>
<td headers="freq_estimate" class="gt_row gt_right">15.1923</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0066</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0004</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">raceblackorafricanamerican</td>
<td headers="bayes_estimate" class="gt_row gt_right">1.4131</td>
<td headers="freq_estimate" class="gt_row gt_right">1.4192</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0061</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0043</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">racewhite</td>
<td headers="bayes_estimate" class="gt_row gt_right">5.4556</td>
<td headers="freq_estimate" class="gt_row gt_right">5.4568</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0012</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0002</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">sexfemale</td>
<td headers="bayes_estimate" class="gt_row gt_right">0.3456</td>
<td headers="freq_estimate" class="gt_row gt_right">0.3381</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0075</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0221</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit1:armcdtrt</td>
<td headers="bayes_estimate" class="gt_row gt_right">3.9842</td>
<td headers="freq_estimate" class="gt_row gt_right">3.9833</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">avisit2:armcdtrt</td>
<td headers="bayes_estimate" class="gt_row gt_right">3.9330</td>
<td headers="freq_estimate" class="gt_row gt_right">3.9308</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0023</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0006</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit3:armcdtrt</td>
<td headers="bayes_estimate" class="gt_row gt_right">2.9795</td>
<td headers="freq_estimate" class="gt_row gt_right">2.9837</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0042</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0014</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit4:armcdtrt</td>
<td headers="bayes_estimate" class="gt_row gt_right">4.4066</td>
<td headers="freq_estimate" class="gt_row gt_right">4.4040</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0026</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">6.2317</td>
<td headers="freq_estimate" class="gt_row gt_right">6.1506</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0811</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0132</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">sigma_avisit2</td>
<td headers="bayes_estimate" class="gt_row gt_right">4.9146</td>
<td headers="freq_estimate" class="gt_row gt_right">4.8526</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0620</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0128</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">sigma_avisit3</td>
<td headers="bayes_estimate" class="gt_row gt_right">3.7775</td>
<td headers="freq_estimate" class="gt_row gt_right">3.7153</td>
<td headers="diff_estimate" class="gt_row gt_right">0.0622</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0167</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">sigma_avisit4</td>
<td headers="bayes_estimate" class="gt_row gt_right">9.7953</td>
<td headers="freq_estimate" class="gt_row gt_right">9.6417</td>
<td headers="diff_estimate" class="gt_row gt_right">0.1536</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">0.0159</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.3607</td>
<td headers="freq_estimate" class="gt_row gt_right">0.3795</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0187</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0493</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.1419</td>
<td headers="freq_estimate" class="gt_row gt_right">0.1523</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0104</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0683</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.0396</td>
<td headers="freq_estimate" class="gt_row gt_right">0.0430</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0034</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0791</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.1680</td>
<td headers="freq_estimate" class="gt_row gt_right">0.1802</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0121</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0674</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.1110</td>
<td headers="freq_estimate" class="gt_row gt_right">0.1178</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0067</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0571</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.0144</td>
<td headers="freq_estimate" class="gt_row gt_right">0.0159</td>
<td headers="diff_estimate" class="gt_row gt_right">−0.0015</td>
<td headers="diff_relative_estimate" class="gt_row gt_right">−0.0929</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"
+   )
```

<!--html_preserve--><div id="sjrjlbjvlt" style="padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>#sjrjlbjvlt 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;
}

#sjrjlbjvlt thead, #sjrjlbjvlt tbody, #sjrjlbjvlt tfoot, #sjrjlbjvlt tr, #sjrjlbjvlt td, #sjrjlbjvlt th {
  border-style: none;
}

#sjrjlbjvlt p {
  margin: 0;
  padding: 0;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_caption {
  padding-top: 4px;
  padding-bottom: 4px;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#sjrjlbjvlt .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#sjrjlbjvlt .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%;
}

#sjrjlbjvlt .gt_spanner_row {
  border-bottom-style: hidden;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_from_md > :first-child {
  margin-top: 0;
}

#sjrjlbjvlt .gt_from_md > :last-child {
  margin-bottom: 0;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_row_group_first td {
  border-top-width: 2px;
}

#sjrjlbjvlt .gt_row_group_first th {
  border-top-width: 2px;
}

#sjrjlbjvlt .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#sjrjlbjvlt .gt_first_summary_row {
  border-top-style: solid;
  border-top-color: #D3D3D3;
}

#sjrjlbjvlt .gt_first_summary_row.thick {
  border-top-width: 2px;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#sjrjlbjvlt .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;
}

#sjrjlbjvlt .gt_sourcenote {
  font-size: 90%;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 5px;
  padding-right: 5px;
}

#sjrjlbjvlt .gt_left {
  text-align: left;
}

#sjrjlbjvlt .gt_center {
  text-align: center;
}

#sjrjlbjvlt .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#sjrjlbjvlt .gt_font_normal {
  font-weight: normal;
}

#sjrjlbjvlt .gt_font_bold {
  font-weight: bold;
}

#sjrjlbjvlt .gt_font_italic {
  font-style: italic;
}

#sjrjlbjvlt .gt_super {
  font-size: 65%;
}

#sjrjlbjvlt .gt_footnote_marks {
  font-size: 75%;
  vertical-align: 0.4em;
  position: initial;
}

#sjrjlbjvlt .gt_asterisk {
  font-size: 100%;
  vertical-align: 0;
}

#sjrjlbjvlt .gt_indent_1 {
  text-indent: 5px;
}

#sjrjlbjvlt .gt_indent_2 {
  text-indent: 10px;
}

#sjrjlbjvlt .gt_indent_3 {
  text-indent: 15px;
}

#sjrjlbjvlt .gt_indent_4 {
  text-indent: 20px;
}

#sjrjlbjvlt .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 5. Comparison of parameter standard errors 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_se" class="gt_row gt_right">1.4125</td>
<td headers="freq_se" class="gt_row gt_right">1.4075</td>
<td headers="diff_se" class="gt_row gt_right">0.0050</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0035</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">fev1_bl</td>
<td headers="bayes_se" class="gt_row gt_right">0.0279</td>
<td headers="freq_se" class="gt_row gt_right">0.0278</td>
<td headers="diff_se" class="gt_row gt_right">0.0001</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0046</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit2</td>
<td headers="bayes_se" class="gt_row gt_right">0.8176</td>
<td headers="freq_se" class="gt_row gt_right">0.7985</td>
<td headers="diff_se" class="gt_row gt_right">0.0191</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0239</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit3</td>
<td headers="bayes_se" class="gt_row gt_right">0.8335</td>
<td headers="freq_se" class="gt_row gt_right">0.8132</td>
<td headers="diff_se" class="gt_row gt_right">0.0203</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0250</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit4</td>
<td headers="bayes_se" class="gt_row gt_right">1.3283</td>
<td headers="freq_se" class="gt_row gt_right">1.3086</td>
<td headers="diff_se" class="gt_row gt_right">0.0198</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0151</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">raceblackorafricanamerican</td>
<td headers="bayes_se" class="gt_row gt_right">0.5857</td>
<td headers="freq_se" class="gt_row gt_right">0.5787</td>
<td headers="diff_se" class="gt_row gt_right">0.0070</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0120</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">racewhite</td>
<td headers="bayes_se" class="gt_row gt_right">0.6252</td>
<td headers="freq_se" class="gt_row gt_right">0.6163</td>
<td headers="diff_se" class="gt_row gt_right">0.0089</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0144</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">sexfemale</td>
<td headers="bayes_se" class="gt_row gt_right">0.5119</td>
<td headers="freq_se" class="gt_row gt_right">0.4927</td>
<td headers="diff_se" class="gt_row gt_right">0.0192</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0390</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit1:armcdtrt</td>
<td headers="bayes_se" class="gt_row gt_right">1.0651</td>
<td headers="freq_se" class="gt_row gt_right">1.0454</td>
<td headers="diff_se" class="gt_row gt_right">0.0197</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0188</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit2:armcdtrt</td>
<td headers="bayes_se" class="gt_row gt_right">0.8260</td>
<td headers="freq_se" class="gt_row gt_right">0.8135</td>
<td headers="diff_se" class="gt_row gt_right">0.0125</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0154</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit3:armcdtrt</td>
<td headers="bayes_se" class="gt_row gt_right">0.6771</td>
<td headers="freq_se" class="gt_row gt_right">0.6657</td>
<td headers="diff_se" class="gt_row gt_right">0.0114</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0171</td></tr>
    <tr><td headers="variable" class="gt_row gt_left">avisit4:armcdtrt</td>
<td headers="bayes_se" class="gt_row gt_right">1.6805</td>
<td headers="freq_se" class="gt_row gt_right">1.6605</td>
<td headers="diff_se" class="gt_row gt_right">0.0200</td>
<td headers="diff_relative_se" class="gt_row gt_right">0.0120</td></tr>
  </tbody>
  
  
</table>
</div><!--/html_preserve-->

# Session info {#session}


```r
> sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Sonoma 14.5
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: America/Indiana/Indianapolis
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] parallel  stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] posterior_1.5.0      mmrm_0.3.11          brms.mmrm_1.0.1.9005
#>  [4] purrr_1.0.2          gtsummary_1.9.9.9003 gt_0.10.1           
#>  [7] ggplot2_3.5.1        tidyr_1.3.1          dplyr_1.1.4         
#> [10] knitr_1.46          
#> 
#> loaded via a namespace (and not attached):
#>  [1] tidyselect_1.2.1     svUnit_1.0.6         farver_2.1.2        
#>  [4] loo_2.7.0            tidybayes_3.0.6      fastmap_1.2.0       
#>  [7] TH.data_1.1-2        tensorA_0.36.2.1     digest_0.6.35       
#> [10] estimability_1.5     lifecycle_1.0.4      StanHeaders_2.32.8  
#> [13] processx_3.8.4       survival_3.5-8       magrittr_2.0.3      
#> [16] compiler_4.4.0       rlang_1.1.4          sass_0.4.9          
#> [19] tools_4.4.0          utf8_1.2.4           labeling_0.4.3      
#> [22] bridgesampling_1.1-2 pkgbuild_1.4.4       curl_5.2.1          
#> [25] plyr_1.8.9           xml2_1.3.6           abind_1.4-5         
#> [28] multcomp_1.4-25      withr_3.0.0          grid_4.4.0          
#> [31] stats4_4.4.0         fansi_1.0.6          xtable_1.8-4        
#> [34] colorspace_2.1-0     inline_0.3.19        emmeans_1.10.1      
#> [37] scales_1.3.0         gtools_3.9.5         MASS_7.3-60.2       
#> [40] ggridges_0.5.6       cli_3.6.2            mvtnorm_1.2-4       
#> [43] generics_0.1.3       RcppParallel_5.1.7   binom_1.1-1.1       
#> [46] reshape2_1.4.4       commonmark_1.9.1     rstan_2.32.6        
#> [49] stringr_1.5.1        splines_4.4.0        bayesplot_1.11.1    
#> [52] matrixStats_1.3.0    brms_2.21.0          vctrs_0.6.5         
#> [55] V8_4.4.2             Matrix_1.7-0         sandwich_3.1-0      
#> [58] jsonlite_1.8.8       callr_3.7.6          arrayhelpers_1.1-0  
#> [61] ggdist_3.3.2         glue_1.7.0           ps_1.7.6            
#> [64] codetools_0.2-20     distributional_0.4.0 stringi_1.8.4       
#> [67] gtable_0.3.5         QuickJSR_1.1.3       munsell_0.5.1       
#> [70] tibble_3.2.1         pillar_1.9.0         htmltools_0.5.8.1   
#> [73] Brobdingnag_1.2-9    TMB_1.9.11           R6_2.5.1            
#> [76] Rdpack_2.6           evaluate_0.23        lattice_0.22-6      
#> [79] highr_0.10           markdown_1.12        cards_0.1.0.9046    
#> [82] rbibutils_2.2.16     backports_1.4.1      trialr_0.1.6        
#> [85] rstantools_2.4.0     Rcpp_1.0.12          coda_0.19-4.1       
#> [88] gridExtra_2.3        nlme_3.1-164         checkmate_2.3.1     
#> [91] xfun_0.43            zoo_1.8-12           pkgconfig_2.0.3
```