๐ค AI Summary
This study addresses the lack of systematic evaluation of R packages for generalized linear mixed models (GLMMs) in terms of estimation accuracy, convergence stability, and computational efficiency. Through Monte Carlo simulations across 24 scenarios, it comprehensively compares seven widely used R packages, uniquely integrating both frequentist approaches (e.g., lme4, GLMMadaptive, glmmTMB) and Bayesian methods (rstanarm, brms). The assessment encompasses convergence rates, computation time, parameter estimation bias, and hypothesis testing power. Results indicate that lme4 with adaptive GaussโHermite quadrature (AGQ) and GLMMadaptive achieve the best balance of accuracy and convergence reliability. In contrast, lme4 with Laplace approximation (LA) and glmmTMB are computationally efficient but exhibit substantial bias. Among Bayesian implementations, rstanarm demonstrates robust performance, whereas brms incurs prohibitively high computational costs. This work provides an evidence-based practical guide for selecting appropriate GLMM software in applied research.
๐ Abstract
Generalized linear mixed models (GLMMs) are widely used for analyzing correlated data, such as longitudinal and multilevel data. With over 15 $\texttt{R}$ packages available on $\texttt{CRAN}$ for fitting GLMMs, practitioners face a difficult choice regarding which package yields accurate estimates, converges reliably, and offers reasonable computational speed. Existing comparisons are either limited to methods within a single package or focus on narrow criteria such as speed alone. To address this gap, we systematically compared seven representative $\texttt{R}$ packages -- $\texttt{lme4}$, $\texttt{GLMMadaptive}$, $\texttt{glmmTMB}$, $\texttt{MASS}$, $\texttt{hglm}$, $\texttt{brms}$, and $\texttt{rstanarm}$ -- that implement different estimation frameworks. By using Monte Carlo simulations across 24 scenarios, we evaluated each package in terms of convergence ratios, computational time, estimation accuracy, and hypothesis testing performance. Our results showed that $\texttt{lme4_AGQ}$ and $\texttt{GLMMadaptive}$ yield the highest accuracy and convergence ratios, although $\texttt{GLMMadaptive}$ becomes slower under complex random-effect structures. $\texttt{lme4_LA}$ and $\texttt{glmmTMB}$ are computationally fast but exhibit lower convergence ratios and larger bias, especially for variance components. $\texttt{MASS}$ and $\texttt{hglm}$ are also fast, but $\texttt{MASS}$ yields liberal univariate tests and $\texttt{hglm}$ lacks support for correlated random effects and multivariate testing. Between two Bayesian packages, $\texttt{rstanarm}$ converges reliably and produces valid univariate tests, whereas $\texttt{brms}$ is extremely slow, limiting its practical utility. Based on these findings, we provide practical recommendations for choosing GLMM tool in applied research.