Introduction and Overview of SWE WG
Mixed Models for Repeated Measures - Why is it a Problem?
MMRM Package
Why this is not “yet another package”
Long Term Perspective
Comparing MMRM R Package to SAS - Demo
Closing and Next Steps
Primary Goal: Collaborate to engineer R packages that implement important statistical methods to fill in critical gaps
Secondary Goal: Develop and disseminate best practices for engineering high-quality open-source statistical software
mmrm
was published on CRAN in October 2022 and updated in December
mmrm
package, and open sourced it at github.com/openpharma/mmrmlme4
and lmerTest
nlme
does not give Satterthwaite adjusted degrees of freedom, has convergence issues, and with emmeans
it is only approximateglmmTMB
to calculate Satterthwaite adjusted degrees of freedomglmmTMB
to calculate Satterthwaite adjusted degrees of freedomglmmTMB
is always using a random effects representation, we cannot have a real unstructured model (uses \(\sigma = \varepsilon > 0\) trick)TMB
) directly - as it is also underlying glmmTMB
- but code the exact model we wantC++
using the TMB
provided librariesTMB
C++
framework for defining objective functions (Rcpp
would have been alternative interface)TMB
interface and plugged into optimizersTo run an MMRM model in SAS it is recommended to use either the PROC MIXED or PROC GLM procedures.
Less model assumptions are applied in PROC MIXED, primarily how one treats missingness.
We will compares the PROC MIXED procedure to the {mmrm}
package in the following attributes:
Both languages have online documentation of the technical details of the estimation and degrees of freedom methods and the different covariance structures available.
{mmrm}
PROC MIXED
One major advantage of the {mmrm}
over PROC MIXED
is that the unit testing in {mmrm}
is transparent. It uses the {testthat}
framework with {covr}
to communicate the testing coverage. Unit tests can be found in the GitHub repository under ./tests.
Note
The integration tests in {mmrm}
are set to a tolerance of 10e^-3 when compared to SAS outputs.
Method | {mmrm} |
PROC MIXED |
---|---|---|
ML | X | X |
REML | X | X |
Tip
For users that need more structure {mmrm}
is easily extensible via feature requests in the GitHub repository.
Covariance structures | {mmrm} |
PROC MIXED |
---|---|---|
Unstructured (Unweighted/Weighted) | X/X | X/X |
Toeplitz (hetero/homo) | X/X | X/X |
Compound symmetry (hetero/homo) | X/X | X/X |
Auto-regressive (hetero/homo) | X/X | X/X |
Ante-dependence (hetero/homo) | X/X | X |
Spatial exponential | X | X |
Method | {mmrm} |
PROC MIXED |
---|---|---|
Contain | X* | X |
Between/Within | X* | X |
Residual | X* | X |
Satterthwaite | X | X |
Kenward-Roger | X | X |
Kenward-Roger (Linear)** | X | X |
*Available through the emmeans
package.
**This is not equivalent to the KR2 setting in PROC MIXED
Contrasts and LSMeans estimates are available in mmrm
using
mmrm::df_1d
, mmrm::df_md
emmeans
pairs
method)mmrm
to emmeans
PROC MIXED
and mmrm
do not adjust for multiplicity, whereas emmeans
does.Note
These are comparable to the LSMEANS statement in PROC MIXED
.
Note
Have an interest in working on these topics? Come work with us, information on the SWE WG can be found here: ASA BIOP SWE WG