Back

demografr: A toolkit for simulation-based inference in population genetics

Petr, M.; Pötzsch, I. M.; Racimo, F.

2025-12-18 evolutionary biology
10.64898/2025.12.18.694482 bioRxiv
Show abstract

Simulation-based inference methods such as Approximate Bayesian Computation (ABC) are a popular class of techniques in evolutionary biology and population genetics. These methods are particularly useful for fitting complex models, as they can bypass the need to compute an exact likelihood function, instead relying on comparisons between observed and simulated summary statistics. However, numerous technical and practical hurdles often hinder the application of these methods to new modeling problems. They require the integration of disparate scripts and software for simulation, computing summary statistics, and inference into pipelines which have to be tailor-made for each specific research project. Moreover, computational costs of population genetic simulations can make inference laborious due to costly file format conversions throughout the entire procedure. Here we present a new R package called demografr (github.com/bodkan/demografr), which aims to alleviate most issues with traditional simulation-based inference workflows while facilitating their application to novel and complex modeling problems. First, demografr leverages the R simulation toolkit slendr for interactive, user-friendly encoding of complex demographic models. Second, demografr allows the user to set up parameter distributions and run simulations from them automatically, with built-in support for parallelization. For this purpose, automated inference routines for ABC or grid-based parameter exploration are provided, with individual components available for developing other simulation-based workflows in the future. Third, demografr allows a wide range of summary statistics to be efficiently computed directly in R, without any need for file conversion. In addition to the default slendr simulation engine, demografr also supports user-defined msprime and SLiM simulation scripts as well as entirely customizable summary statistic functions. We illustrate the features of demografr on examples which would traditionally require complex workflows with hundreds of lines of code: estimating parameters of a demographic model via coalescent simulations using ABC, exploring the influence of a set of parameters on summary statistics of interest using parameter grid search, and showcasing the ability to integrate fully customized simulation code written in pure Python or SLiM.

Matching journals

The top 5 journals account for 50% of the predicted probability mass.

50% of probability mass above

"Similar papers" are the closest papers from that journal in the model's embedding space. They show what the match is built on, but the ranking comes mostly from a classifier over the whole training set, not from these examples alone.