Skip to main content
QUICK REVIEW

[Paper Review] Inference, prediction and optimization of non-pharmaceutical interventions using compartment models: the PyRoss library

R. Adhikari, Austen Bolitho|arXiv (Cornell University)|May 19, 2020
COVID-19 epidemiological studiesMathematics14 citations
TL;DR

PyRoss is an open-source Python library that integrates Bayesian inference, prediction, and optimization for non-pharmaceutical interventions (NPIs) in age- and contact-structured compartment models. It enables stochastic and deterministic simulations, supports mid-run transitions between models, and allows full Bayesian forecasting and optimization of NPIs using data-driven parameter estimation and model evidence comparison.

ABSTRACT

PyRoss is an open-source Python library that offers an integrated platform for inference, prediction and optimisation of NPIs in age- and contact-structured epidemiological compartment models. This report outlines the rationale and functionality of the PyRoss library, with various illustrations and examples focusing on well-mixed, age-structured populations. The PyRoss library supports arbitrary structured models formulated stochastically (as master equations) or deterministically (as ODEs) and allows mid-run transitioning from one to the other. By supporting additional compartmental subdivision ad libitum, PyRoss can emulate time-since-infection models and allows medical stages such as hospitalization or quarantine to be modelled and forecast. The PyRoss library enables fitting to epidemiological data, as available, using Bayesian parameter inference, so that competing models can be weighed by their evidence. PyRoss allows fully Bayesian forecasts of the impact of idealized NPIs by convolving uncertainties arising from epidemiological data, model choice, parameters, and intrinsic stochasticity. Algorithms to optimize time-dependent NPI scenarios against user-defined cost functions are included. PyRoss's current age-structured compartment framework for well-mixed populations will in future reports be extended to include compartments structured by location, occupation, use of travel networks and other attributes relevant to assessing disease spread and the impact of NPIs. We argue that such compartment models, by allowing social data of arbitrary granularity to be combined with Bayesian parameter estimation for poorly-known disease variables, could enable more powerful and robust prediction than other approaches to detailed epidemic modelling. We invite others to use the PyRoss library for research to address today's COVID-19 crisis, and to plan for future pandemics.

Motivation & Objective

  • To develop a unified, open-source platform for inference, prediction, and optimization of non-pharmaceutical interventions (NPIs) in epidemiological compartment models.
  • To support both stochastic (master equation) and deterministic (differential equation) formulations of age-structured and contact-structured models.
  • To enable mid-run switching between stochastic and deterministic model representations for improved computational efficiency and accuracy.
  • To provide tools for Bayesian parameter inference, model comparison via evidence, and uncertainty quantification across data, parameters, and model structure.
  • To optimize NPI scenarios—such as lockdown timing and duration—against user-defined cost functions using fully Bayesian forecasting.

Proposed method

  • Uses Markovian compartment models with age and contact structure, where individuals are grouped into disease states (e.g., S, E, I, R) and subdivided by age and medical status.
  • Employs the method of stages to approximate time-since-infection dynamics using additional compartments, enabling more realistic disease progression modeling.
  • Applies the $Ω$-expansion and diffusion limit approximations to bridge stochastic and deterministic dynamics in large-population limits.
  • Utilizes non-stationary Gauss-Markov processes and nested sampling for Bayesian parameter inference and model evidence computation.
  • Implements posterior predictive distributions to forecast NPI impacts, accounting for data, parameter, model, and intrinsic stochasticity uncertainties.
  • Supports optimization of time-dependent NPIs via cost function minimization, with integration of uncertainty propagation throughout the forecasting pipeline.

Experimental results

Research questions

  • RQ1How can compartment models be extended to incorporate age structure, contact matrices, and medical staging (e.g., hospitalization) while maintaining computational tractability?
  • RQ2To what extent can Bayesian inference and model evidence be used to guide model selection and prevent overfitting in data-limited epidemic modeling?
  • RQ3How can uncertainty from data, parameters, model structure, and stochasticity be systematically propagated through forecasts of NPI outcomes?
  • RQ4Can optimization of NPIs (e.g., lockdown duration and timing) be systematically performed using cost functions that balance public health and socioeconomic impacts?
  • RQ5How can real-time data from implemented NPIs be used to update prior beliefs and inform predictions about future interventions?

Key findings

  • PyRoss enables seamless switching between stochastic and deterministic formulations of compartment models during simulation, improving flexibility and accuracy.
  • The library supports arbitrary subdivision of compartments by age, contact structure, and medical states (e.g., ICU, quarantine), allowing detailed modeling of disease progression and intervention impact.
  • Bayesian parameter inference with model evidence computation allows principled model comparison and prevents overfitting, even in data-poor scenarios.
  • Full Bayesian forecasting of NPI outcomes accounts for uncertainties in data, parameters, model choice, and intrinsic stochasticity, enabling robust scenario analysis.
  • Optimization of NPIs using user-defined cost functions allows systematic ranking and selection of intervention strategies, such as minimizing infection burden or economic cost.
  • The framework supports time-dependent contact matrices, enabling modeling of NPIs like lockdowns and phased reopenings with data-informed parameter updates.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.