Approximate Bayesian Computation Made Easy: A Practical Guide to ABC-SMC for Dynamical Systems with \texttt{pymc}
Mario Castro
TL;DR
This work addresses parameter inference for mechanistic dynamical models when likelihoods are intractable by presenting ABC-SMC as an accessible, likelihood-free Bayesian approach implemented in PyMC. Through four case studies—ranging from fully observed Lotka–Volterra to latent-structural SEIR with hierarchical pooling—the tutorial demonstrates practical workflow, diagnostics, and interpretation of approximate posteriors and posterior predictive checks. It emphasizes design choices (summaries, distances, tolerances), diagnostic tools (ESS, tolerance trajectories, PPCs), and strategies to leverage partial observability and information sharing across groups. By combining a practical, example-driven narrative with a unified PyMC-based interface, the paper provides a transferable blueprint for researchers to apply ABC-SMC to complex biological systems and to progressively integrate likelihood-based methods as needed.
Abstract
Mechanistic models are essential tools across ecology, epidemiology, and the life sciences, but parameter inference remains challenging when likelihood functions are intractable. Approximate Bayesian Computation with Sequential Monte Carlo (ABC-SMC) offers a powerful likelihood-free alternative that requires only the ability to simulate data from mechanistic models. Despite its potential, many researchers remain hesitant to adopt these methods due to perceived complexity. This tutorial bridges that gap by providing a practical, example-driven introduction to ABC-SMC using Python. From predator-prey dynamics to hierarchical epidemic models, we illustrate by example how to implement, diagnose, and interpret ABC-SMC analyses. Each example builds intuition about when and why ABC-SMC works, how partial observability affects parameter identifiability, and how hierarchical structures naturally emerge in Bayesian frameworks. All code leverages PyMC's modern probabilistic programming interface, ensuring reproducibility and easy adaptation to new problems. The code its fully available for download at \href{https://github.com/mariocastro73/ABCSMC_pymc_by_example}{mariocastro73/ABCSMC\_pymc\_by\_example}
