Search bioRxiv⌕ Search

bioRxiv · 10.1101/132753

Modeling Zero-Inflated Count Data With glmmTMB

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.\n\nWe 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 glmmTMB and compare it to other available methods using two ecological case studies.\n\nIn general, glmmTMB 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, glmmTMB makes it easier to find appropriate models and test hypotheses to describe ecological processes.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Brooks, M. E., Kristensen, K., van Benthem, K. J., Magnusson, A., Berg, C. W., Nielsen, A., Skaug, H. J., Maechler, M., Bolker, B. M.. 2017-05-01. Modeling Zero-Inflated Count Data With glmmTMB. https://doi.org/10.1101/132753

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related preprints

MillionTrees: A global benchmark for tree detection across geography, sensor, and annotation geometry

Airborne tree monitoring using remotely sensed data, combined with the growth of computer vision models for object detection and segmentation, can facilitate broad scale assessment of tree health, ecology and ecosystem function. However, datasets for airborne tree detection have been largely limited to a single geography, resolution, or annotation approach, making it difficult to develop general models and benchmark their utility for broad applications. We compile existing and newly published annotation datasets to create a comprehensive dataset for training and evaluating airborne tree detection in RGB imagery. The MillionTrees dataset has over a million individual trees from a broad range of forest types, tree species, and geographic locations. In addition, it has six million weakly supervised annotations from a range of sources including airborne LiDAR and photogrammetry, arborist surveys, and simulated landscapes. An evaluation standard is provided to facilitate rapid model development. We benchmark several existing tree detection algorithms and demonstrate that while current open-source models do not generalize across the diverse datasets in the benchmark, training on MillionTrees improves both within-domain and out-of-domain performance. Held-out validation datasets using ground truth derived from terrestrial LiDAR paired with overhead RGB show that overfitting to test data is common and hyperparameter tuning is an underappreciated challenge towards a global zero shot tree detection method. We discuss the limitations of the currently available data for airborne RGB tree detection, how to create more robust evaluation data and the need for better understanding of the uncertainty and utility of tree detection from airborne remote sensing.

ecology↗

Individual-specific recovery of the healthy human gut microbiota after antibiotics

Following disruption by broad-spectrum antibiotics, the human gut microbiome undergoes a prolonged recovery where coarse ecological features, such as species richness and diversity, are largely restored. However, as these features are shared by most healthy individuals, it remains unclear whether, even after strong perturbation, individuals preferentially return toward their own pre-treatment composition ('individual-specific recovery') or instead switch to alternative equally healthy states. Resolving this question is fundamental for evaluating the long-term impacts of antibiotics, because an individual's health is affected by their unique microbiome composition, affecting immune regulation and metabolic processing, so a state switch, even to a broadly healthy configuration, could carry unintended consequences. Here we compare each subject's post-antibiotic endpoint with their own baseline and with the baselines of every other subject, across four cohorts (n = 121) whose regimens ranged from a five-day fluoroquinolone course to a four-day three-drug combination given to deplete the gut community. The recovered community was significantly closer to the subject's own baseline than to the alternative healthy baselines in more than 90% of individuals under the mildest regimen and in two thirds of those under regimens that broadly target the gut anaerobes, remaining above chance in every cohort and the majority outcome even where most baseline taxa fell below detection during treatment. This specificity is not merely the persistence and fast regrowth of survivors: it persists among baseline taxa that remain undetected for weeks to months, and the same taxon re-establishes more readily in a host where it was previously detected than in one where it was not. Newly established taxa are consistently more functionally similar to the pre-treatment community than transient arrivals, and their identity correlates with the surviving community's composition in a substantial fraction of subjects. State switching, in contrast, was uncommon and occurred almost exclusively among subjects with the largest reduction in detected taxa during the treatment. Together, these observations reveal the individual-specific nature of the microbiome resilience to broad-spectrum antibiotics, whereas the compositional changes are not random but rather functionally and ecologically associated with the subject's baseline.

ecology↗

Tropical Peatlands as Hotspots of Hidden Arcellinida Diversity: Insights from Maludam National Park, Borneo (Sarawak, Malaysia)

Recent investigations on tropical peatlands have shown their extremely high efficiency as carbon sinks, far beyond better studied boreal bogs. The microbial diversity found in those ecosystems, as well as their corresponding ecological and metabolic processes, are just starting to be revealed, and differ considerably from high latitudes systems. However, these efforts have been concentrated almost exclusively towards prokaryotes and fungi, leaving protist communities virtually unknown. Arcellinida (testate amoebae) are well acknowledged to play an important role in boreal and temperate peatland ecology by driving microbial community composition as top predators, but also as nutrient recyclers and carbon fixers. Yet, to our knowledge, no community-level study has addressed their diversity and its drivers in tropical peatlands. In this study, we surveyed Arcellinida communities' diversity across five functionally distinct vegetation-hydrological zones situated along a hydrological transect in a coastal tropical peatland in the Maludam National Park, Malaysia. Taxonomic composition of Arcellinida communities, characterized by a high diversity of Trigonopyxis-related taxa, indicated fundamental differences in diversity and community composition from extratropical ecosystems. Species richness was significantly higher in the zones with developed understory vegetation. Furthermore, the composition of diversity varied significantly among vegetation-hydrological zones. Altogether, this study shows unique Arcellinida communities in a Southeastern Asian peatland and suggests the importance of vegetation-hydrological characteristics for protist diversity.

ecology↗