Thebrms.mmrm R package implements a mixed model ofrepeated measures (MMRM), a popular and flexible model to analyzecontinuous longitudinal outcomes (Mallinckrodt etal. (2008),Mallinckrodt and Lipkovich(2017),Holzhauer and Weber(2024)).brms.mmrm focuses on marginal MMRMs forrandomized controlled parallel studies with discrete time points, whereeach patient shares the same set of time points. Whereas themmrm packageis frequentist,brms.mmrm fits models in Bayesian fashionusingbrms(Bürkner 2017).
Let\(y_1, \ldots, y_N\) beindependent data points observed for individual patients in a clinicaltrial. Each\(y_n\) is a numeric vectorof length\(T\), where\(T\) is the number of discrete time pointsin the dataset (e.g. patient visits in the study protocol). We model\(y_n\) as follows:
\[\begin{aligned}y_n \sim \text{Multivariate-Normal}\left ( \text{mean} = X_n b, \\text{variance} = \Sigma_n \right )\end{aligned}\] Above,\(X_n\) is the fixedeffect model matrix of patient\(n\),and its specific makeup is determined by arguments such asintercept andgroup inbrm_formula().\(b\) is aconstant-length vector of fixed effect parameters.
The MMRM inbrms.mmrm is adistributionalmodel, which means it uses a linear regression structure for boththe mean and the variance of the multivariate normal likelihood. Inparticular, the\(T \times T\)symmetric positive-definite residual covariance matrix\(\Sigma_n\) of patient\(n\) decomposes as follows:
\[\begin{aligned}\Sigma_n &= \text{diag}(\sigma_n) \cdot \Lambda \cdot\text{diag}(\sigma_n) \\\sigma_n &= \text{exp} \left ( Z_n b_\sigma \right)\end{aligned}\]
Above,\(\sigma_n\) is a vector of\(T\) time-specific scalar standarddeviations, and\(\text{diag}(\sigma_n)\) is a diagonal\(T \times T\) matrix.\(Z_n\) is a patient-specific matrix whichcontrols how thedistributionalparameters\(b_\sigma\) map to themore intuitive standard deviation vector\(\sigma_n\). The specific makeup of\(Z_n\) is determined by thesigma argument ofbrm_formula(), which in turnis produced bybrm_formula_sigma().
\(\Lambda\) is a symmetricpositive-definite correlation matrix with diagonal elements equal to 1and off-diagonal elements between -1 and 1. The structure of\(\Lambda\) depends on thecorrelation argument ofbrm_formula(), whichcould describe an unstructured parameterization, ARMA, compoundsymmetry, etc. These alternative structures and priors are availabledirectly throughbrms. For specific details, please consulthttps://paulbuerkner.com/brms/reference/autocor-terms.htmland?brms.mmrm::brm_formula.
The scalar components of\(b\) aremodeled as independent with user-defined priors specified through theprior argument ofbrm_model(). Thehyperparameters of these priors are constant. The default priors areimproper uniform for non-intercept terms and a data-dependent Student-tdistribution for the intercept. The variance-related distributionalparameters\(b_\sigma\) are givensimilar priors
For the correlation matrix\(\Lambda\), the default prior inbrms.mmrm is theLKJcorrelation distribution with shape parameter equal to 1. Thischoice of prior is only valid for unstructured correlation matrices.Other correlation structures, such ARMA, will parameterize\(\Lambda\) and allow users to set priors onthose new specialized parameters.
brms.mmrm, throughbrms, fits themodel to the data using the Markov chain Monte Carlo (MCMC) capabilitiesofStan(StanDevelopment Team 2023). Please readhttps://mc-stan.org/users/documentation/ for moredetails on the methodology ofStan.The result of MCMC is a collection of draws from the full jointposterior distribution of the parameters given the data. Individualdraws of scalar parameters such as\(\beta_3\) are considered draws from themarginal posterior distribution of e.g. \(\beta_3\) given the data.
Under the missing at random (MAR) assumptions, MMRMs do not requireimputation (Holzhauer and Weber (2024)).However, if the outcomes in your data are not missing at random, or ifyou are targeting an alternative estimand, then you may need to imputemissing outcomes.brms.mmrm can leverage either of the twoalternative solutions described athttps://paulbuerkner.com/brms/articles/brms_missings.html.Please see theusagevignette for details on the implementation and interface.