Package: mmrm 0.3.18

Daniel Sabanes Bove

mmrm: Mixed Models for Repeated Measures

Mixed models for repeated measures (MMRM) are a popular choice for analyzing longitudinal continuous outcomes in randomized clinical trials and beyond; see Cnaan, Laird and Slasor (1997) <doi:10.1002/(SICI)1097-0258(19971030)16:20%3C2349::AID-SIM667%3E3.0.CO;2-E> for a tutorial and Mallinckrodt, Lane, Schnell, Peng and Mancuso (2008) <doi:10.1177/009286150804200402> for a review. This package implements MMRM based on the marginal linear model without random effects using Template Model Builder ('TMB') which enables fast and robust model fitting. Users can specify a variety of covariance matrices, weight observations, fit models with restricted or standard maximum likelihood inference, perform hypothesis testing with Satterthwaite or Kenward-Roger adjustment, and extract least square means estimates by using 'emmeans'.

Authors:Daniel Sabanes Bove [aut, cre], Liming Li [aut], Julia Dedic [aut], Doug Kelkhoff [aut], Kevin Kunzmann [aut], Brian Matthew Lang [aut], Christian Stock [aut], Ya Wang [aut], Craig Gower-Page [ctb], Dan James [aut], Jonathan Sidi [aut], Daniel Leibovitz [aut], Daniel D. Sjoberg [aut], Nikolas Ivan Krieger [aut], Lukas A. Widmer [ctb], Arryn Panagos [aut], Jeremiah Jones [aut], Boehringer Ingelheim Ltd. [cph, fnd], Gilead Sciences, Inc. [cph, fnd], F. Hoffmann-La Roche AG [cph, fnd], Merck Sharp & Dohme, Inc. [cph, fnd], AstraZeneca plc [cph, fnd], inferential.biostatistics GmbH [cph, fnd]

mmrm_0.3.18.tar.gz
mmrm_0.3.18.zip(r-4.7)mmrm_0.3.18.zip(r-4.6)mmrm_0.3.18.zip(r-4.5)
mmrm_0.3.18.tgz(r-4.6-x86_64)mmrm_0.3.18.tgz(r-4.6-arm64)mmrm_0.3.18.tgz(r-4.5-x86_64)mmrm_0.3.18.tgz(r-4.5-arm64)
mmrm_0.3.18.tar.gz(r-4.7-arm64)mmrm_0.3.18.tar.gz(r-4.7-x86_64)mmrm_0.3.18.tar.gz(r-4.6-arm64)mmrm_0.3.18.tar.gz(r-4.6-x86_64)
mmrm_0.3.18.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
mmrm/json (API)

# Install 'mmrm' in R:
install.packages('mmrm', repos = c('https://pharmaverse.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/openpharma/mmrm/issues

Pkgdown/docs site:https://openpharma.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

cpp

13.37 score 158 stars 9 packages 201 scripts 7.6k downloads 17 exports 43 dependencies

Last updated from:4e9f20fa44. Checks:13 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK416
linux-devel-x86_64OK504
source / vignettesOK687
linux-release-arm64OK444
linux-release-x86_64OK502
macos-release-arm64OK232
macos-release-x86_64OK637
macos-oldrel-arm64OK265
macos-oldrel-x86_64OK520
windows-develOK557
windows-releaseOK585
windows-oldrelOK537
wasm-releaseOK320

Exports:as.cov_structaugmentcomponentcov_structcov_typesdf_1ddf_mdemp_startfit_mmrmfit_single_optimizerglancemmrmmmrm_controlrefit_multiple_optimizersstd_starttidyVarCorr

Dependencies:backportsbriocallrcheckmateclicrayondescdiffobjevaluatefsgenericsgluejsonlitelatticelifecyclemagrittrMASSMatrixnlmeotelpillarpkgbuildpkgconfigpkgloadpraiseprocessxpsR6rbibutilsRcppRcppEigenRdpackrlangrprojrootstringistringrtestthattibbleTMButf8vctrswaldowithr

Covariance Structures
Introduction | Covariance and Correlation Matrices | Transformation to Variance Parameters | Unstructured (us) | Homogeneous (ad) and Heterogeneous Ante-dependence (adh) | Homogeneous (toep) and Heterogeneous Toeplitz (toeph) | Homogeneous (ar1) and Heterogeneous (ar1h) Autoregressive | Homogeneous (cs) and Heterogeneous (csh) Compound Symmetry | Spatial Covariance Structure | Spatial exponential (sp_exp) | Spatial Gaussian (sp_gau) | References

Last update: 2026-06-17
Started: 2022-07-04

Kenward-Roger
Model definition | Linear model | Mathematical Details of Kenward-Roger method | Special Considerations for mmrm models | Derivative of the overall covariance matrix $\Sigma$ | Derivative of the $\Sigma^{-1}$ | Subjects with missed visits | Scenario under group specific covariance estimates | Scenario under weighted mmrm | Inference | Parameterization methods and Kenward-Roger | Implementations in mmrm | Spatial Exponential Derivatives | Spatial Gaussian Derivatives | References

Last update: 2026-06-17
Started: 2022-12-09

Model-Robust Variance Estimator for G-Computation
Background | G-Computation Estimator | Covariance Estimator of $\hat{\theta}_t$ | Implementation

Last update: 2026-06-12
Started: 2026-06-12

Prediction and Simulation
Prediction of conditional mean | Mathematical Derivations | Implementation of predict | Parametric Sampling for Prediction Interval | Prediction of Conditional Mean for New Subjects | Simulate response | Conditional Simulation | Marginal Simulation | Implementation of simulate | Relationship Between predict and simulate Results | predict options | simulate options | Comparison with SAS

Last update: 2026-06-12
Started: 2023-06-06

Details of Weighted Least Square Empirical Covariance
Weighted Least Square (WLS) Empirical Covariance | Difference of Implementations | Proof of Identity | Proof for Covariance Estimator | Proof for Degrees of Freedom | Special Considerations in Implementations | Pseudo Inverse of a Matrix | Avoiding the Crossproduct of the G Matrix | References

Last update: 2026-01-09
Started: 2023-03-16

Package Structure
Introduction | Package Structures | data | data-raw | design | SAS | TMB | inst | man | NAMESPACE | NEWS.md | R | README | simulations | src | chol_cache.h | covariance.h | derivatives.h | empirical.cpp | exports.cpp | jacobian.cpp | kr_comp.cpp | Makevars | mmrm.cpp | predict.cpp | test files | tmb.cpp and tmb_includes.h | utils.h | tests | vignettes | Other files | _pkgdown.yml | .gitignore | .lintr | .pre-commit-config.yaml | .Rbuildignore

Last update: 2026-01-09
Started: 2022-10-10

Details of Hypothesis Testing
Introduction to Type I/II/III Hypothesis Testing | Contained Effect | Type II Hypothesis Testing | Type III Hypothesis Testing | Hypothesis Testing in SAS | Special Considerations | Reference Levels | Example of Reference Levels | Why Model Covariate Order Changes My Testing in SAS? | Why mmrm Gives More Covariates Than SAS? | Excluding columns due to collinearity | Intercept-free models | Intercept-free Models with stats::model.matrix() | Intercept-free Models with PROC MIXED | Type-II Contrast Matrices in Intercept-free Models

Last update: 2025-12-09
Started: 2023-12-22

Comparison with other software
Introduction | Datasets | FEV Data | BCVA Data | Model Implementations | Ante-dependence (heterogeneous) | PROC GLIMMIX | mmrm | Ante-dependence (homogeneous) | Auto-regressive (heterogeneous) | gls | Auto-regressive (homogeneous) | glmmTMB | Compound symmetry (heterogeneous) | Compound symmetry (homogeneous) | Spatial exponential | Toeplitz (heterogeneous) | Toeplitz (homogeneous) | Unstructured | lmer | Benchmarking | Convergence Times | Marginal Treatment Effect Estimates Comparison | Impact of Missing Data on Convergence Rates | Session Information

Last update: 2025-05-28
Started: 2023-05-06

Coefficients Covariance Matrix Adjustment
Introduction | Asymptotic Covariance | Empirical Covariance | Jackknife Covariance | Bias-Reduced Covariance | Kenward-Roger Covariance

Last update: 2025-01-13
Started: 2023-02-02

Model Fitting Algorithm
Model definition | Linear model | Covariance matrix model | Unstructured covariance matrix | Grouped covariance matrix | Spatial covariance matrix | Maximum Likelihood Estimation | Weighted least squares estimator | Determinant and quadratic form | Restricted Maximum Likelihood Estimation | Completing the square | Objective function

Last update: 2024-01-10
Started: 2022-06-30

Package Introduction
Common usage | Common customizations | Extraction of model features | Lower level functions | Hypothesis testing | Tidymodels | Acknowledgments | References

Last update: 2024-01-10
Started: 2022-04-28

Between-Within
General definition | MMRM special case | Example | Differences compared to SAS | References

Last update: 2023-10-25
Started: 2023-08-23

Mixed Models for Repeated Measures
Abstract | The basic linear mixed-effects model | Extending the basic linear mixed-effects model | The MMRM as a special case | Missing data | References

Last update: 2023-10-25
Started: 2023-02-02

Satterthwaite
Satterthwaite degrees of freedom for asymptotic covariance | One-dimensional contrast | Jacobian approach | Jacobian calculation | Multi-dimensional contrast | Satterthwaite degrees of freedom for empirical covariance | References

Last update: 2023-10-25
Started: 2022-12-16

Readme and manuals

Help Manual

Help pageTopics
'mmrm' Packagemmrm-package
Coerce into a Covariance Structure Definitionas.cov_struct as.cov_struct.formula
Example Data on BCVAbcva_data
Component Access for 'mmrm_tmb' Objectscomponent
Define a Covariance Structurecov_struct
Covariance Typescovariance_types cov_types
Calculation of Degrees of Freedom for One-Dimensional Contrastdf_1d
Calculation of Degrees of Freedom for Multi-Dimensional Contrastdf_md
Support for 'emmeans'emmeans_support
Empirical Starting Valueemp_start
Example Data on FEV1fev_data
Low-Level Fitting Function for MMRMfit_mmrm
Fitting an MMRM with Single Optimizerfit_single_optimizer
Format Covariance Structure Objectformat.cov_struct
Fit an MMRMmmrm
Control Parameters for Fitting an MMRMmmrm_control
Tidying Methods for 'mmrm' Objectsaugment.mmrm glance.mmrm mmrm_tidiers tidy.mmrm
Methods for 'mmrm_tmb' ObjectsAIC.mmrm_tmb BIC.mmrm_tmb coef.mmrm_tmb deviance.mmrm_tmb fitted.mmrm_tmb formula.mmrm_tmb logLik.mmrm_tmb mmrm_tmb_methods model.frame.mmrm_tmb model.matrix.mmrm_tmb predict.mmrm_tmb print.mmrm_tmb residuals.mmrm_tmb simulate.mmrm_tmb terms.mmrm_tmb VarCorr VarCorr.mmrm_tmb vcov.mmrm_tmb
Print a Covariance Structure Objectprint.cov_struct
Refitting MMRM with Multiple Optimizersrefit_multiple_optimizers
Analysis of Variance for 'mmrm' Fitsanova.mmrm stats_anova
Standard Starting Valuestd_start