PreprintCited by 440Statistical Methods and Bayesian InferenceData Analysis with RStatistical Distribution Estimation and Applications

Modeling zero-inflated count data with glmmTMB

Open access
Brooks, Mollie E., Kristensen, Kasper, van Benthem, Koen J., Magnusson, Arni, Berg, Casper W., Nielsen, Anders, Skaug, Hans J., Mächler, Martin +1 more·2017·bioRxiv (Cold Spring Harbor Laboratory)

Abstract

Ecological phenomena are often measured in the form of count data. These data can be analyzed using generalized linear mixed models (GLMMs) when observations are correlated in ways that require random effects. However, count data are often zero-inflated , containing more zeros than would be expected from the standard error distributions used in GLMMs, e.g., parasite counts may be exactly zero for hosts with effective immune defenses but vary according to a negative binomial distribution for non-resistant hosts. We present a new R package, glmmTMB , that increases the range of models that can easily be fitted to count data using maximum likelihood estimation. The interface was developed to be familiar to users of the lme4 R package, a common tool for fitting GLMMs. To maximize speed and flexibility, estimation is done using Template Model Builder ( TMB ), utilizing automatic differentiation to estimate model gradients and the Laplace approximation for handling random effects. We demonstrate glmm TMB and compare it to other available methods using two ecological case studies. In general, glmm TMB is more flexible than other packages available for estimating zero-inflated models via maximum likelihood estimation and is faster than packages that use Markov chain Monte Carlo sampling for estimation; it is also more flexible for zero-inflated modelling than INLA , but speed comparisons vary with model and data structure. Our package can be used to fit GLMs and GLMMs with or without zero-inflation as well as hurdle models. By allowing ecologists to quickly estimate a wide variety of models using a single package, glmm TMB makes it easier to find appropriate models and test hypotheses to describe ecological processes.

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

Crossref · 10.1101/132753

Cites

2 of 2 references verified0 citation errors · 0 not checkable

Statistics

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • All variables met normality assumptions except HIV-transmission-risk behavior, AUDIT, DUDIT, and SIDAS, which were zero-inflated; generalized linear mixed models with square root transformation were used for AUDIT, DUDIT, and SIDAS, and a negative binomial zero-inflated regression for HIV-transmission-risk behavior.

    “All variables met assumptions of normality except for HIV-transmission-risk behavior, AUDIT, DUDIT, and SIDAS, which were zero-inflated.”

    From Guided internet-based LGBTQ-affirmative cognitive-behavioral therapy: A randomized controlled trial among sexual minority men in China (2024) · cites this paper as Brooks et al., 2017

    Split into 2 atoms — 0 confirmed, 1 partially supported, 0 disputed, 0 misattributed, 1 unverifiable. Expand the claim to see per-atom verdicts.

    Experimental — accuracy not yet measured
  • Non-Gaussian models with multiple random effects often fail to reach model convergence.

    “Unfortunately, non-Gaussian models with multiple random effects often fail to reach model convergence (e.g., Brooks et al., 2017)”

    From Violating the normality assumption may be the lesser of two evils (2021) · cites this paper as Brooks et al., 2017

    The case-study discussion (lines 185–195; page not provided) reports that two zero-inflated negative binomial models did not converge. It does not say that non-Gaussian models with multiple random effects often fail to converge, or link those failures to having multiple random effects. (LLM, conf=0.85)

    Experimental — accuracy not yet measured

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

Cites

Flagged first, then by citations

Research works printed but not linked: 10

  1. Bolker, B. M. (2015). Linear and Generalized Linear Mixed Models. In G. A. Fox, S. Negrete-Yankelevich, & V. J. Sosa (Eds.), Ecological Statistics. Oxford 240 University Press, Oxford, UK.
  2. Bolker, B. M., Gardner, B., Maunder, M., Berg, C. W., Brooks, M., Comita, L., Crone, E., Cubaynes, S., Davies, T., de Valpine, P., Ford, J., Gimenez, O., Kéry, M., Kim, E. J., Lennert-Cody, C., Magnusson, A., Martell, S., Nash, J., Nielsen, A., Regetz, J., Skaug, H., & Zipkin, E. (2013). Strategies for fitting nonlinear ecological models in R, AD Model Builder, and BUGS. Methods in 250 Ecology and Evolution, 4 , 501-512. doi:10.1111/2041-210X.12044. · DOI
  3. Gurevitch, J., & Hedges, L. V. (1999). Statistical issues in ecological meta- analyses. Ecology, 80 , 1142-1149. URL: http://www.jstor.org/stable/ 260 177061.
  4. Hadfield, J. D. (2010). MCMC methods for multi-response generalized linear mixed models: The MCMCglmm r package. Journal of Statistical Software, 33 , 1-22.
  5. Kristensen, K., Nielsen, A., Berg, C. W., Skaug, H., & Bell, B. (2016). TMB: Automatic differentiation and Laplace approximation. Journal of Statistical Software, 70 , 1-21. 270
  6. International license a certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under The copyright holder for this preprint (which was not this version posted May 1, 2017. ; https://doi.org/10.1101/132753 doi: bioRxiv preprint abundance of stream salamanders. Journal of Applied Ecology, 53 , 459-468. doi:10.1111/1365-2664.12585. 285 · DOI
  7. Rhodes, J. R. (2015). Mixture models for overdispersed data. In G. A. Fox, S. Negrete-Yankelevich, & V. J. Sosa (Eds.), Ecological Statistics. Oxford University Press, Oxford, UK. 290
  8. Roulin, A., & Bersier, L. (2007). Nestling barn owls beg more intensely in the presence of their mother than in the presence of their father. Animal Behaviour , 74 , 1099-1106. doi:10.1016/j.anbehav.2007.01.027. · DOI
  9. Rue, H., Martino, S., & Chopin, N. (2009). Approximate bayesian inference for latent gaussian models by using integrated nested laplace approximations. 295 Journal of the royal statistical society: Series b (statistical methodology), 71 , 319-392.
  10. Zeileis, A., Kleiber, C., & Jackman, S. (2008). Regression models for count data in R. Journal of Statistical Software, 27 , 1-25.

Cited by

Sorted by citations

Authors
Brooks, M. E., Kristensen, K., van Benthem, K. J., Magnusson, A., Berg, C. W., Nielsen, A., Skaug, H. J., Mächler, M., & Bolker, B. M.
Affiliations
  • University of Zurich (CH)
  • Technical University of Denmark (DK)
  • University of Bergen (NO)
  • McMaster University (CA)
Corresponding author
Brooks, Mollie E.
Venue
bioRxiv (Cold Spring Harbor Laboratory)
Publisher
openRxiv
Published
2017-05-01
OpenAlex
W2611208896
Cited by
440
References
2
Citations by year
2026: 52 · 2025: 68 · 2024: 59 · 2023: 47 · 2022: 43 · 2021: 47 · 2020: 47 · 2019: 41 · 2018: 32 · 2017: 2 · 2016: 1
Type
posted content
Language
en
Open access
Locations
bioRxiv (Cold Spring Harbor Laboratory) (acceptedVersion, cc-by-nc)
Funders
  • National Science Foundation
  • Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung (161670)
Topics
  • Physical Sciences › Mathematics › Statistics and Probability › Statistical Methods and Bayesian Inference
  • Physical Sciences › Computer Science › Artificial Intelligence › Data Analysis with R
  • Physical Sciences › Mathematics › Statistics and Probability › Statistical Distribution Estimation and Applications
Keywords
zero-inflated count data, glmmTMB, generalized linear mixed models, Template Model Builder, automatic differentiation, Laplace approximation, random effects, hurdle models, parasite count, negative binomial distribution, R package, computational speed comparison

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review