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.
翻译:广义线性混合模型(GLMMs)广泛应用于分析相关性数据,如纵向数据和多层数据。由于CRAN上有超过15个R包可用于拟合GLMMs,实践者面临一个困难的选择:哪个包能够提供准确的估计、可靠地收敛,并具有合理的计算速度。现有的比较要么局限于单一包内的方法,要么仅关注速度等狭窄标准。为弥补这一空白,我们系统比较了七个具有代表性的R包——lme4、GLMMadaptive、glmmTMB、MASS、hglm、brms和rstanarm——它们实现了不同的估计框架。通过使用24种情景的蒙特卡洛模拟,我们评估了每个包的收敛率、计算时间、估计准确性和假设检验性能。结果显示,lme4_AGQ和GLMMadaptive在准确性和收敛率方面表现最佳,尽管GLMMadaptive在复杂随机效应结构下变得较慢。lme4_LA和glmmTMB计算速度快,但收敛率较低且偏差较大,尤其在方差分量方面。MASS和hglm也很快,但MASS产生宽松的单变量检验,而hglm缺乏对相关随机效应和多变量检验的支持。在两个贝叶斯包中,rstanarm可靠收敛并生成有效的单变量检验,而brms极其缓慢,限制了其实用性。基于这些发现,我们为应用研究中选择GLMM工具提供了实用建议。