bioRxivEcology
Including random effects in statistical models in ecology: fewer than five levels?
Abstract
As generalized linear mixed-effects models (GLMMs) have become a widespread tool in ecology, the need to guide the use of such tools is increasingly important. One common guideline is that one needs at least five levels of a random effect. Having such few levels makes the estimation of the variance of random effects terms (such as ecological sites, individuals, or populations) difficult, but it need not muddy ones ability to estimate fixed effects terms - which are often of primary interest in ecology. Here, I simulate ecological datasets and fit simple models and show that having too few random effects terms does not influence the parameter estimates or uncertainty around those estimates for fixed effects terms. Thus, it should be acceptable to use fewer levels of random effects if one is not interested in making inference about the random effects terms (i.e. they are nuisance parameters used to group non-independent data). I also use simulations to assess the potential for pseudoreplication in (generalized) linear models (LMs), when random effects are explicitly ignored and find that LMs do not show increased type-I errors compared to their mixed-effects model counterparts. Instead, LM uncertainty (and p values) appears to be more conservative in an analysis with a real ecological dataset presented here. These results challenge the view that it is never appropriate to model random effects terms with fewer than five levels - specifically when inference is not being made for the random effects, but suggest that in simple cases LMs might be robust to ignored random effects terms. Given the widespread accessibility of GLMMs in ecology and evolution, future simulation studies and further assessments of these statistical methods are necessary to understand the consequences of both violating and blindly following simple guidelines.
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- Fixed or random? On the reliability of mixed-effects models for a small number of levels in grouping variables
J. Oberpriller, M. de Souza Leite, M. Pichler·bioRxiv·May 3, 2021
- On the problems of not accounting for measurement- and sampling uncertainty in ecological and environmental models
C. Damgaard·bioRxiv·Mar 16, 2020
- Estimating extreme displacements under a Lomax generalized linear model framework: the role of sample size and threshold choice
Francisca Javiera Rudolph, José Miguel Ponciano·bioRxiv·Jan 29, 2025
- Known unknowns and model selection in ecological evidence synthesis
Shane A. Blowes·EcologyPeer-reviewed·Jan 1, 2026
- Modeling Zero-Inflated Count Data With glmmTMB
Mollie E. Brooks, Kasper Kristensen, … Benjamin M. Bolker·bioRxiv·May 1, 2017
- Optimal sample size calculation for null hypothesis significance tests
J. Mudge, J. Houlahan·bioRxiv·Feb 4, 2019