Assessment of Simulation-based Inference Methods for Stochastic Compartmental Models

Vincent Wieland, Nils Wassmuth, Lorenzo Contento, Martin Kühn, Jan HasenauerarXiv 2025 · DOI

Abstract

Global pandemics, such as the recent COVID-19 crisis, highlight the need for stochastic epidemic models that can capture the randomness inherent in the spread of disease. Such models must be accompanied by methods for estimating parameters in order to generate fast nowcasts and short-term forecasts that can inform public health decisions. This paper presents a comparison of two advanced Bayesian inference methods: 1) pseudo-marginal particle Markov chain Monte Carlo, short Particle Filters (PF), and 2) Conditional Normalizing Flows (CNF). We investigate their performance on two commonly used compartmental models: a classical Susceptible-Infected-Recovered (SIR) model and a two-variant Susceptible-Exposed-Infected-Recovered (SEIR) model, complemented by an observation model that maps latent trajectories to empirical data. Addressing the challenges of intractable likelihoods for parameter inference in stochastic settings, our analysis highlights how these likelihood-free methods provide accurate and robust inference capabilities. The results of our simulation study further underscore the effectiveness of these approaches in capturing the stochastic dynamics of epidemics, providing prediction capabilities for the control of epidemic outbreaks. Results on an Ethiopian cohort study demonstrate operational robustness under real-world noise and irregular data sampling.

Introduction

To make informed public health decisions during a pandemic, epidemiologists rely on mathematical models to forecast disease spread. While standard deterministic models (ODEs) are computationally efficient, they fail to capture the inherent randomness of real-world transmission, especially in small populations or during the early stages of an outbreak. Stochastic compartmental models—based on stochastic differential equations (SDEs)—solve this by incorporating randomness directly into the model dynamics.

However, this realism comes at a steep computational cost: parameter inference. Finding unknown model parameters (like transmission or recovery rates) that best explain observed data requires calculating a likelihood function. In stochastic models, this means marginalizing over all possible unobserved latent states, making the likelihood function mathematically "intractable." Traditional likelihood-based inference methods fail here, creating a need for robust, likelihood-free alternatives.

Methodology

The authors evaluate two advanced likelihood-free Bayesian inference methods:

  • Particle Filters (PF) / Pseudo-marginal MCMC: A traditional, exact approach. It uses a sequential Monte Carlo method (a bootstrap particle filter) to simulate the latent epidemic states and generate an unbiased estimate of the likelihood. This estimate is then fed into an adaptive Metropolis-Hastings Markov chain Monte Carlo (MCMC) algorithm to sample from the parameter posterior.
  • Conditional Normalizing Flows (CNF): A modern machine learning approach falling under Neural Posterior Estimation (NPE). Instead of sampling during inference, it uses an invertible neural network to learn a mapping from a simple base distribution (like a Gaussian) directly to the complex posterior distribution. The network is trained offline on a massive dataset of model simulations. Once trained, inference for new data is nearly instantaneous (amortized inference).
Overview of the parameter estimation workflow comparing Particle Filters and Conditional Normalizing Flows.

Experimental Setup and Data

The methods were evaluated on both synthetic and real-world datasets:

  1. Synthetic Data: Dense and sparse (irregularly sampled) time-series data generated from two models: a standard SIR (Susceptible-Infected-Recovered) model and a complex two-variant SEIR model. The SEIR model (illustrated below) tracks susceptible, exposed, infected, and recovered populations across multiple viral variants.
  2. Real-World Data: A longitudinal cohort study tracking the early COVID-19 outbreak in Ethiopia, featuring both infection count data (from testing) and seroprevalence data (antibodies).
Structure of the two-variant SEIR model used for evaluation.

Key Results and Insights

The Speed vs. Precision Trade-off

CNF was approximately 10 times faster than PF during the inference phase across all datasets, even when restricted to CPU execution. This makes CNF highly attractive for real-time pandemic nowcasting. However, CNF tends to produce wider, slightly less calibrated posteriors. In contrast, PF hones in on tighter parameter spaces but suffers from high computational costs and lower effective sample sizes (ESS) in complex landscapes.

Handling Non-Identifiability

In complex models like the two-variant SEIR, different parameter combinations can produce virtually identical epidemic curves (practical non-identifiability). PF tends to collapse into specific high-likelihood basins, potentially ignoring the broader parameter manifold, while CNF captures the wider range of possible parameters but struggles with exact calibration. The authors found that redesigning the model to combine highly correlated parameters (e.g., estimating the basic reproduction number $R_0$ instead of separate transmission and recovery rates) drastically improved the alignment between PF and CNF posteriors.

Robustness to Data Irregularity

Both methods successfully captured the data dynamics, matching or improving upon baseline deterministic estimates used in the original Ethiopian COVID-19 study. Furthermore, both methods successfully handled sparse, irregularly sampled data with missing modalities without a significant drop in predictive accuracy.

Conclusion and Future Work

While both methods accurately fit complex models with intractable likelihoods, they serve different operational needs. CNF offers a significant speedup through amortized neural inference, whereas PF provides tighter, asymptotically exact posterior estimates at a higher computational cost.

Future work suggests exploring "hybrid" approaches. For example, using the fast, broad tail coverage of neural estimators like CNF to generate high-quality parameter proposals for exact pseudo-marginal MCMC schemes. This could combine the speed and robustness of machine learning with the asymptotic correctness of traditional particle methods to better inform public health decision-making.

Summary updated

BibTeX
@misc{wieland2025assessment,
  author = {Vincent Wieland and Nils Wassmuth and Lorenzo Contento and Martin Kühn and Jan Hasenauer},
  title = {{Assessment of Simulation-based Inference Methods for Stochastic Compartmental Models}},
  year = {2025},
  eprint = {2512.02528},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.02528},
  howpublished = {arXiv},
}
Figure