SearcharxivSearch

arXiv · 2609.13333

Sequential reduction for discrete latent variables in ecological and evolutionary models using RTMB

Abstract

Statistical models of ecological and evolutionary dynamics often include latent variables that are either continuous (e.g., average body size) or discrete (e.g., numerical abundance). Mixed-type hierarchical models containing both are typically fitted using Markov chain Monte Carlo (MCMC), which can be prohibitively slow for large models. Here, we introduce an alternative in the R package RTMB that automates the sequential reduction of small groups of related discrete variables, allowing them to be efficiently marginalized. Sequential reduction is combined with automatic differentiation and the Laplace approximation to estimate parameters and predict both continuous and discrete variables. We demonstrate speed and flexibility using demographic examples (occupancy, dynamic occupancy, N-mixture, and open dynamic N-mixture models), benchmarking RTMB against JAGS and unmarked. We then develop two novel applications. The first is a multi-site open N-mixture model with a spatial latent variable governing site-specific initial abundance and recruitment, which shows that continuous Gaussian Markov random fields can be estimated jointly with discrete abundance dynamics in under a minute. The second is phylogenetic trait imputation for a published data set of female Liolaemus lizards, where we jointly impute a binary trait (viviparity), estimate its state-switching rates, and estimate its effect on a continuous trait (body size) during ancestral state reconstruction. This indicates that phylogenetic comparative methods can estimate linkages among discrete and continuous traits. We envision that intuitive and efficient specification of mixed-type models will allow more expressive representation of ecological and evolutionary dynamics.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Christopher L. Cahill, James T. Thorson, Kasper Kristensen. 2026-09-11. Sequential reduction for discrete latent variables in ecological and evolutionary models using RTMB. https://arxiv.org/abs/2609.13333

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

KEEP EXPLORING

Related papers

Phase transitions in microbial lineage trees

Microbial populations exhibit high cell-to-cell variability, which fundamentally shapes population behavior. A striking consequence is the existence of phase transitions, where small genetic or environmental changes trigger abrupt shifts in population dynamics. While biological phase transitions have often been proposed, connecting observed behavior to the underlying physics has remained challenging. We combine population genetics with statistical physics to show how phase transitions arise naturally in microbial populations. We highlight the existence of a first-order transition in a model of bacterial plasmid engineering and find a strict lower bound on the number of plasmids that can be stably maintained in a population.

q-bio.PE

Phylogenetic Inference and the Stickiness of Fréchet Means, via Precise Asymptotics of an Embedded Random Walk

A well-known phenomenon in statistical analyses of populations of phylogenetic trees in the Billera-Holmes-Vogtmann space is that the topology of the Fréchet mean tree can contain multifurcations (i.e., internal nodes with more than two children), which raises the practical question of whether this reflects a population-level branching structure (hard polytomy) or merely sampling variability in the data (soft polytomy). This is an instance of the more general phenomenon of "stickiness" in non-Euclidean statistics, whereby the sample Fréchet mean in certain non-positively curved stratified spaces becomes permanently trapped in a lower-dimensional stratum. In this work, we identify a particular multidimensional random walk embedded within the Fréchet mean process, and we show that the time at which stickiness occurs is determined by the largest last-passage time above zero of the coordinates of this random walk. Using this representation, we develop a fully nonparametric procedure for estimating the probability that trifurcations in a sample Fréchet mean tree will bifurcate at some future time if more observations are collected. Lastly, we apply our methodology to a problem in phylogenetics where we consider whether an observed trifurcation in the species tree of primates, glires, and tree shrews is genuinely trifurcated at the population level.

q-bio.PE

Coexistence coalitions in propagule disperser quasi-communities

Many natural ecosystems harbor large numbers of coexisting species competing for far fewer distinct resources, in apparent defiance of the competitive exclusion principle. Various mechanisms have been proposed to explain this apparent paradox, often pertaining to organisms with a two-stage sessile--propagule life cycle. Here we develop a stochastic model class for such propagule disperser communities that combines competition--colonization trade-offs, spatial heterogeneity, demographic stochasticity, as well as inherited trait variation, and recover several classical models as special or limiting cases. Using bifurcation analysis, we classify equilibrium coalitions near the extinction threshold and give sufficient conditions for their realization by macroscopic equilibria away from the threshold, bypassing the costly numerical computation of the actual equilibrium states. Illustrative examples examine the resulting trait distributions and coalition patterns, demonstrating the interactive effects of different coexistence mechanisms.

q-bio.PE