[Paper Review] EggCounts: a Bayesian hierarchical toolkit to model faecal egg count reductions
This paper introduces the R package eggCounts, a Bayesian hierarchical toolkit implemented in Stan for modeling faecal egg count reductions (FECR) in veterinary parasitology. It addresses limitations of traditional FECRT by modeling aggregation, sampling variability, zero-inflation, small samples, and outliers using gamma-Poisson hierarchical models with efficient MCMC sampling, yielding reliable credible intervals and intuitive outputs for non-expert users.
This is a vignette for the R package eggCounts version 2.0. The package implements a suite of Bayesian hierarchical models dealing with faecal egg count reductions. The models are designed for a variety of practical situations, including individual treatment efficacy, zero inflation, small sample size (less than 10) and potential outliers. The functions are intuitive to use and their output are easy to interpret, such that users are protected from being exposed to complex Bayesian hierarchical modelling tasks. In addition, the package includes plotting functions to display data and results in a visually appealing manner. The models are implemented in Stan modelling language, which provides efficient sampling technique to obtain posterior samples. This vignette briefly introduces different models, and provides a short walk-through analysis with example data.
Motivation & Objective
- Address the limitations of conventional FECRT, which fails under low pre-treatment counts, high aggregation, zero-inflated data, and small sample sizes.
- Provide a user-friendly Bayesian framework that protects non-statistical specialists from complex modeling tasks while ensuring methodological rigor.
- Improve estimation reliability by modeling both biological aggregation (gamma distribution) and sampling variability (Poisson distribution) in faecal egg counts.
- Enable robust inference under challenging data conditions such as zero post-treatment counts and potential outliers, which standard methods cannot handle.
- Facilitate interpretation through intuitive outputs, diagnostic tools, and visualization functions for posterior distributions and model convergence.
Proposed method
- Implement Bayesian hierarchical models using the Stan probabilistic programming language for efficient Hamiltonian Monte Carlo (HMC) sampling via the No-U-Turn Sampler (NUTS).
- Model faecal egg counts with a gamma-Poisson hierarchical structure: the gamma distribution captures inter-individual aggregation, and the Poisson distribution models sampling variability.
- Incorporate individual treatment efficacy by allowing per-animal reduction parameters (delta) with a beta prior, enabling estimation of individual-level treatment effects.
- Handle zero-inflated data by extending models to include a mixture component for excess zeros, improving accuracy in post-treatment samples with no observed eggs.
- Support small sample sizes (<10) through robust priors and model structures that reduce overfitting and improve posterior precision.
- Integrate diagnostic checks such as potential scale reduction factors (R-hat < 1.1) and trace plots to assess MCMC convergence automatically.
Experimental results
Research questions
- RQ1How can Bayesian hierarchical models improve the estimation of faecal egg count reduction (FECR) compared to traditional FECRT, especially in low-count or high-aggregation scenarios?
- RQ2To what extent do gamma-Poisson hierarchical models account for both biological aggregation and sampling variability in faecal egg count data?
- RQ3Can the package reliably estimate FECR when all post-treatment counts are zero, a scenario where conventional methods fail?
- RQ4How effective is the model in small sample settings (n < 10) where standard methods suffer from high variance and poor coverage?
- RQ5How do model diagnostics and posterior predictive checks help users assess model fit and detect potential outliers or prior-data conflicts?
Key findings
- The model estimated a median FECR of 89.8% with a 95% equal-tailed credible interval of (83.4%, 94.1%) in a simulated paired dataset with 15 animals and true reduction of 90%.
- The probability that the true reduction is less than 95% was estimated at 99.25%, demonstrating the model's ability to quantify uncertainty in treatment efficacy.
- No evidence of non-convergence was found, as all R-hat values were below 1.1, confirming reliable MCMC sampling after 2000 iterations with 1000 warm-up samples.
- Posterior traceplots and density plots confirmed that the model's priors (e.g., Beta(1,1) for reduction, Gamma(1,0.7) for aggregation) were well-calibrated and consistent with the data.
- The package successfully handled zero-inflated data and small samples, outperforming traditional FECRT in scenarios with high variability and low pre-treatment counts.
- Model outputs were interpretable and visually enhanced via built-in plotting functions, supporting user confidence in results without requiring deep statistical expertise.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.