openstatsware
and the R Package {mmrm}
China-R Conference
2023-11-28
Authors:
Thanks to:
openstatsware
)openstatsware
{mmrm}
!openstatsware
)openstatsware
openstatsware
: mmrm
lme4
with lmerTest
, learned that this approach failed on large data sets (slow, did not converge)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 freedom, but it did not workTMB
) directly
glmmTMB
C++
using the TMB
provided librariesSAS
TMB
C++
framework for defining objective functions (Rcpp
would have been alternative interface)TMB
interface and plugged into optimizersmmrm
emmeans
interface for least square meanstidymodels
builtin parsnip engine and recipes for streamlined model fitting workflowsteal
, tern
, rtables
integration for post processing and reportingrbmi
for conditional mean imputation!To run an MMRM model in SAS it is recommended to use either the PROC MIXED
or PROC GLMMIX
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
{mmrm}
are transparent, compared to PROC MIXED
.testthat
framework with covr
to communicate the testing coverage.Note
The integration tests in {mmrm}
are set to a tolerance of 10e^-3 when compared to SAS outputs.
Tip
For users that need more structures, {mmrm}
is easily extensible - let us know 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 |
Covariance estimators | {mmrm} |
PROC MIXED |
---|---|---|
Asymptotic | X | X |
Kenward-Roger | X | X |
Empirical | X | X |
Jackknife | X | |
Bias-Reduced Linearization | 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 emmeans
, and ongoing work in mmrm
.
** Unstructured has differences compared to PROC MIXED
because of different parameterization.
Contrasts and least square (LS) means 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
.
Other R packages, like nlme
, lme4
and glmmTMB
can support MMRM analysis. However:
lme4
)Satterthwaite
and Kenward-Roger
degrees of freedom, or Sandwich covariance estimator.mmrm
not only supports multiple covariance structure, it also has good efficiency (due to fast implementations in C++)
{mmrm}
has small difference from SAS
mmrm
is on CRAN - use this as a starting point: