Hostname: page-component-745bb68f8f-g4j75 Total loading time: 0 Render date: 2025-01-07T11:02:43.534Z Has data issue: false hasContentIssue false

Computation and application of generalized linear mixed model derivatives using lme4

Published online by Cambridge University Press:  01 January 2025

Ting Wang
Affiliation:
American Board of Family Medicine
Benjamin Graves
Affiliation:
University of Missouri
Yves Rosseel
Affiliation:
Ghent University
Edgar C. Merkle*
Affiliation:
University of Missouri
*
Correspondence should be made to Edgar C. Merkle, University of Missouri, Columbia, MO, USA. Email: merklee@missouri.edu

Abstract

Maximum likelihood estimation of generalized linear mixed models (GLMMs) is difficult due to marginalization of the random effects. Derivative computations of a fitted GLMM’s likelihood are also difficult, especially because the derivatives are not by-products of popular estimation algorithms. In this paper, we first describe theoretical results related to GLMM derivatives along with a quadrature method to efficiently compute the derivatives, focusing on fitted lme4 models with a single clustering variable. We describe how psychometric results related to item response models are helpful for obtaining the derivatives, as well as for verifying the derivatives’ accuracies. We then provide a tutorial on the many possible uses of these derivatives, including robust standard errors, score tests of fixed effect parameters, and likelihood ratio tests of non-nested models. The derivative computation methods and applications described in the paper are all available in easily obtained R packages.

Type
Application Reviews and Case Studies
Copyright
Copyright © 2022 The Author(s) under exclusive licence to The Psychometric Society

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Barr, D. J.,Levy, R., Scheepers, C., & Tily, H. J., (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal Journal of Memory and Language 68 255278 10.1016/j.jml.2012.11.001CrossRefGoogle ScholarPubMed
Bates, D. (2021). Computational methods for mixed models. lme4 Package Vignette. Retrieved from https://cran.r-project.org/web/packages/lme4/vignettes/Theory.pdfGoogle Scholar
Bates, D.,Mächler, M., Bolker, B., & Walker, S., (2015). Fitting linear mixed-effects models using lme4 Journal of Statistical Software 67(1) 148 10.18637/jss.v067.i01CrossRefGoogle Scholar
Bauer, D. J., & Curran, P. J., (2004). The integration of continuous and discrete latent variable models: Potential problems and promising opportunities Psychological Methods 9(1) 329 10.1037/1082-989X.9.1.3CrossRefGoogle ScholarPubMed
Bock, R. D., & Lieberman, M., (1970). Fitting a response model for n dichotomously scored items Psychometrika 35 179198 10.1007/BF02291262CrossRefGoogle Scholar
Bürkner, P-C, (2018). Advanced Bayesian multilevel modeling with the R package brms The R Journal 10(1) 395411 10.32614/RJ-2018-017CrossRefGoogle Scholar
Cai, L., (2010). High-dimensional exploratory item factor analysis by a Metropolis-Hastings Robbins-Monro algorithm Psychometrika 75(1) 3357 10.1007/s11336-009-9136-xCrossRefGoogle Scholar
Cai, L., (2010). A two-tier full-information item factor analysis model with applications Psychometrika 75(4) 581612 10.1007/s11336-010-9178-0CrossRefGoogle Scholar
Chalmers, R. P., (2012). mirt: A multidimensional item response theory package for the R environment Journal of Statistical Software 48(6) 129 10.18637/jss.v048.i06CrossRefGoogle Scholar
De Boeck, P.,Bakker, M., Zwitser, R.,Nivard, M., Hofman, A.,Tuerlinckx, F., Partchev, I., (2011). The estimation of item response models with the lmer function from the lme4 package in R Journal of Statistical Software 39(12) 128 10.18637/jss.v039.i12CrossRefGoogle Scholar
De Boeck, P., & Wilson, M., Explanatory item response models: A generalized linear and nonlinear approach New York Springer 10.1007/978-1-4757-3990-9Google Scholar
Doran, H.,Bates, D., Bliese, P., & Dowling, M., (2004). Estimating the multilevel Rasch model: With the lme4 package Journal of Statistical Software (2007). 20(2) 118 10.18637/jss.v020.i02Google Scholar
Embretson, S. E., & Reise, S. P., Item response theory for psychologists Mahwah, NJ Erlbaum AssociatesGoogle Scholar
Engle, R. F. (1984). Wald, likelihood ratio, and Lagrange multiplier tests in econometrics. In Z. Griliches & M. D. Intriligator (Eds.), Handbook of econometrics. Elsevier.Google Scholar
Fokkema, M., Smits, N., Zeileis, A., Hothorn, T., & Kelderman, H. (2018). Detecting treatment-subgroup interactions in clustered data with generalized linear mixed-effects model trees. Behavior Research Methods, 50, 2016-2034. Retrieved from http://link.springer.com/article/10.3758/s13428-017-0971-xCrossRefGoogle Scholar
Glas, C. A. W., (2000). A Rasch model with a multivariate distribution of ability Objective measurement: Theory into practice (1992). 1 236258Google Scholar
Glas, C. A. W., (1998). Detection of differential item functioning using Lagrange multiplier tests Statistica Sinica 8(3) 647667Google Scholar
Glas, C. A. W., (1999). Modification indices for the 2-PL and the nominal response model Psychometrika 64 273294 10.1007/BF02294296CrossRefGoogle Scholar
Hothorn, T., & Zeileis, A. (2015). partykit: A modular toolkit for recursive partytioning in R. Journal of Machine Learning Research, 16, 3905-3909. Retrieved from http://jmlr.org/papers/v16/hothorn15a.htmlGoogle Scholar
Huber, P. J. (1967). The behavior of maximum likelihood estimates under nonstandard conditions. In Proceedings of the fifth Berkeley symposium on mathematical statistics and probability (Vol. 1, pp. 221-233).Google Scholar
Komboz, B.,Strobl, C., Zeileis, A., (2018). Tree-based global model tests for polytomous Rasch models Educational and Psychological Measurement 78(1) 128166 10.1177/0013164416664394CrossRefGoogle ScholarPubMed
Liu, Q., & Pierce, D. A., (1994). A note on Gauss-Hermite quadrature Biometrika 81 624629Google Scholar
Lord, F. M., & Novick, M. R., Statistical theories of mental test scores Reading, MA Addison-WesleyGoogle Scholar
Louis, T. A. (1982). Finding the observed information matrix when using the EM algorithm. Journal of the Royal Statistical Society. Series B (Methodological), 44(2), 226-233.CrossRefGoogle Scholar
Matuschek, H.,Kliegl, R., Vasishth, S.,Baayen, H., Bates, D., (1968). Balancing Type I error and power in linear mixed models Journal of Memory and Language (2017). 94 305315 10.1016/j.jml.2017.01.001CrossRefGoogle Scholar
McCullagh, P., & Nelder, J. A., Generalized linear models Boca Raton, FL Chapman & Hall 10.1007/978-1-4899-3242-6Google Scholar
McCulloch, C. E., & Neuhaus, J. M. (2001). Generalized linear mixed models. Wiley.CrossRefGoogle Scholar
McCulloch, C. E., & Neuhaus, J. M. (2005). Generalized linear mixed models. In P. Armitage & T. Colton (Eds.), Encyclopedia of Biostatistics. https://doi.org/10.1002/0470011815.b2a10021CrossRefGoogle Scholar
Merkle, E. C.,Fan, J., Zeileis, A., (1989). Testing for measurement invariance with respect to an ordinal variable Psychometrika (2014). 79 569584 10.1007/s11336-013-9376-7CrossRefGoogle Scholar
Merkle, E. C.,Furr, D., Rabe-Hesketh, S., (2019). Bayesian comparison of latent variable models: Conditional versus marginal likelihoods Psychometrika 84 802829 10.1007/s11336-019-09679-0CrossRefGoogle ScholarPubMed
Merkle, E. C., & You, D. (2018). nonnest2 : Tests of non-nested models [Computer software manual]. Retrieved from https://cran.r-project.org/package=nonnest2 (R package version 0.5- 2)Google Scholar
Merkle, E. C.,You, D., Preacher, K. J., (2016). Testing nonnested structural equation models Psychological Methods 21(2) 151163 10.1037/met0000038CrossRefGoogle ScholarPubMed
Merkle, E. C., & Zeileis, A., (2013). Tests of measurement invariance without subgroups: A generalization of classical methods Psychometrika 78 5982 10.1007/s11336-012-9302-4CrossRefGoogle ScholarPubMed
Naylor, J. C., & Smith, A. F. M., (1982). Applications of a method for the efficient computation of posterior distributions Journal of the Royal Statistical Society C 31 214225Google Scholar
Nelder, J., & Lee, Y., (1992). Likelihood, quasi-likelihood and pseudolikelihood: some comparisons Journal of the Royal Statistical Society: Series B (Methodological) 54(1) 273284CrossRefGoogle Scholar
Open Source Psychometrics Project. (n.d.). Open psychology data: Raw data from online [Computer software manual]. Retrieved 2017-10-17, from https://openpsychometrics.org/_rawdata/Google Scholar
Petersen, K. B., & Pedersen, M. S. (2012). The matrix cookbook. Technical University of Denmark. Retrieved from http://www2.imm.dtu.dk/pubdb/p.php3274 (Version 20121115)Google Scholar
Pinheiro, J. C., & Bates, D. M., (1995). Approximations to the log-likelihood function in the nonlinear mixed-effects model Journal of Computational Graphics and Statistics 4 1235CrossRefGoogle Scholar
Powell, M. J. D. (2009). The BOBYQA algorithm for bound constrained optimization without derivatives. Report No. DAMTP 2009/NA06, Centre for Mathematical Sciences, University of Cambridge, UK. http://www.damtp.cam.ac.uk/user/na/NA_papers/NA2009_06.pdf.Google Scholar
R Core Team. (2020). R: A language and environment for statistical computing [Computer software manual]. Vienna, Austria. Retrieved from https://www.R-project.org/Google Scholar
Rabe-Hesketh, S.,Skrondal, A., Pickles, A., (2005). Maximum likelihood estimation of limited and discrete dependent variable models with nested random effects Journal of Econometrics 128(2) 301323 10.1016/j.jeconom.2004.08.017CrossRefGoogle Scholar
Rasbash, J., & Goldstein, H., (1994). Efficient analysis of mixed hierarchical and cross-classified random structures using a multilevel model Journal of Educational and Behavioral Statistics 19 337350 10.3102/10769986019004337CrossRefGoogle Scholar
Schabenberger, O. (2005). Introducing the GLIMMIX procedure for generalized linear mixed models. SUGI 30 Proceedings, 196.Google Scholar
Schneider, L.,Chalmers, R. P., Debelak, R., & Merkle, E. C., (2020). Model selection of nested and non-nested item response models using Vuong tests Multivariate Behavioral Research 55 664684 10.1080/00273171.2019.1664280CrossRefGoogle ScholarPubMed
Shao, X., & Zhang, X., (2010). Testing for change points in time series Journal of the American Statistical Association 105(491) 12281240 10.1198/jasa.2010.tm10103CrossRefGoogle Scholar
Skrondal, A., & Rabe-Hesketh, S., Generalized latent variable modeling: Multilevel, longitudinal, and structural equation modeling Boca Raton, FL Chapman & Hall 10.1201/9780203489437Google Scholar
Strobl, C.,Kopf, J., Zeileis, A., (2004). Rasch trees: A new method for detecting differential item functioning in the Rasch model Psychometrika (2015). 80(2) 289316 10.1007/s11336-013-9388-3 24352514CrossRefGoogle Scholar
Stroup, W. W., Generalized linear mixed models: Modern concepts, methods and applications USA CRC PressGoogle Scholar
Stroup, W. W., & Claassen, E. (2020). Pseudo-likelihood or quadrature What we thought we knew, what we think we know, and what we are still trying to figure out. Journal of Agricultural. Biological and Environmental Statistics, 25(4), 639–656.CrossRefGoogle Scholar
Thall, P. F., & Vail, S. C. (1990). Some covariance models for longitudinal count data with overdispersion. Biometrics, 46(3), 657–671.CrossRefGoogle Scholar
Trepte, S., & Verbeet, M. (Eds.). (2010). Allgemeinbildung in Deutschland–erkenntnisse aus dem SPIEGEL Studentenpisa-Test. Wiesbaden: VS Verlag.Google Scholar
Vuong, Q. H., (2012). Likelihood ratio tests for model selection and non-nested hypotheses Econometrica (1989). 57 307333 10.2307/1912557CrossRefGoogle Scholar
Wang, T., & Merkle, E. C., (2018). merDeriv: Derivative computations for linear mixed effects models with application to robust standard errors Journal of Statistical Software 87(1) 116 10.18637/jss.v087.c01CrossRefGoogle Scholar
Wang, T., Merkle, E. C., Anguera, J. A., & Turner, B. M. (2020). Score-based tests for detecting heterogeneity in linear mixed models. Behavior Research Methods, 53, 216–231.CrossRefGoogle Scholar
Wang, T.,Strobl, C., Zeileis, A., & Merkle, E. C., (2018). Score-based tests of differential item functioning via pairwise maximum likelihood estimation Psychometrika 83(1) 132155 10.1007/s11336-017-9591-8CrossRefGoogle ScholarPubMed
White, H., (1980). A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity Econometrica: Journal of the Econometric Society 48(4) 817838 10.2307/1912934CrossRefGoogle Scholar
Zeileis, A. (2004). Econometric computing with HC and HAC covariance matrix estimators. Journal of Statistical Software, 11(10), 1-17. Retrieved from http://www.jstatsoft.org/v11/i10/CrossRefGoogle Scholar
Zeileis, A., (2006). Object-oriented computation of sandwich estimators Journal of Statistical Software 16(9) 116 10.18637/jss.v016.i09CrossRefGoogle Scholar
Zeileis, A., & Hornik, K., (2007). Generalized M-fluctuation tests for parameter instability Statistica Neerlandica 61 488508 10.1111/j.1467-9574.2007.00371.xCrossRefGoogle Scholar
Zeileis, A., & Hothorn, T. (2002). Diagnostic checking in regression relationships. R News, 2(3), 7-10. Retrieved from https://CRAN.R-project.org/doc/Rnews/Google Scholar
Zeileis, A., Köll, S., & Graham, N. (2020). Various versatile variances: An object-oriented implementation of clustered covariances in R. Journal of Statistical Software. https://doi.org/10.18637/jss.v095.i01CrossRefGoogle Scholar
Zeileis, A., Leisch, F., Hornik, K., & Kleiber, C. (2002). strucchange: An R package for testing for structural change in linear regression models. Journal of Statistical Software, 7(2), 1-38. Retrieved from http://www.jstatsoft.org/v07/i02/CrossRefGoogle Scholar
Zhang, X.,Shao, X., Hayhoe, K., & Wuebbles, D. J., (2011). Testing the structural stability of temporally dependent functional observations and application to climate projections Electronic Journal of Statistics 5 17651796 10.1214/11-EJS655CrossRefGoogle Scholar