Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Pyro ppl Pyro Epidemiological Modeling

From Leeroopedia


Knowledge Sources
Domains Epidemiology, Compartmental Models, Bayesian Inference
Last Updated 2026-02-09 09:00 GMT

Overview

SIR and SEIR compartmental models partition a population into epidemiological states (Susceptible, Exposed, Infected, Recovered) and model disease transmission dynamics through differential equations governing transitions between states.

Description

Compartmental models are the workhorse of mathematical epidemiology. They divide a population into mutually exclusive compartments based on disease status and model the flow of individuals between compartments.

SIR model (Susceptible-Infected-Recovered): The simplest useful epidemic model:

  • S: Susceptible individuals who can become infected.
  • I: Infected individuals who can transmit the disease.
  • R: Recovered (or removed) individuals who are immune.

The dynamics are governed by two parameters:

  • beta: Transmission rate (rate at which susceptible individuals become infected through contact with infected individuals).
  • gamma: Recovery rate (rate at which infected individuals recover).

SEIR model adds an Exposed (E) compartment for the latent period between infection and becoming infectious, controlled by an additional parameter:

  • sigma: Rate of progression from exposed to infectious (inverse of latent period).

Regional/spatial models extend these to multiple interacting populations (e.g., different cities or regions), where individuals can transmit disease across regions through travel or spatial proximity.

In a Bayesian framework, compartmental models are combined with:

  • Observation models: Linking true disease dynamics to noisy, incomplete observations (reported cases, hospitalizations, deaths).
  • Parameter priors: Encoding prior knowledge about transmission rates, recovery times, and reporting rates.
  • Stochastic dynamics: Replacing deterministic ODEs with stochastic processes to capture randomness in disease transmission.

Usage

Use epidemiological compartmental models when:

  • Modeling the spread of infectious diseases through populations.
  • Estimating key epidemiological parameters (R0, infection fatality rate) from observed data.
  • Forecasting future disease incidence and evaluating intervention scenarios.
  • Assessing the impact of public health interventions (vaccination, social distancing).
  • Modeling spatial spread of disease across regions.

Theoretical Basis

SIR ordinary differential equations:

# Deterministic SIR model:
# dS/dt = -beta * S * I / N
# dI/dt = beta * S * I / N - gamma * I
# dR/dt = gamma * I

# N = S + I + R (constant population)
# R_0 = beta / gamma  (basic reproduction number)
# If R_0 > 1: epidemic grows
# If R_0 < 1: epidemic dies out

# Epidemic peak occurs when S = N / R_0
# Final size equation: log(S_inf/S_0) = -R_0 * (1 - S_inf/N)

SEIR extension:

# dS/dt = -beta * S * I / N
# dE/dt = beta * S * I / N - sigma * E
# dI/dt = sigma * E - gamma * I
# dR/dt = gamma * I

# Additional parameter:
# sigma = 1 / latent_period  (rate of becoming infectious)
# Generation time = 1/sigma + 1/gamma

Stochastic discrete-time model:

# For Bayesian inference, discretize to daily time steps:
# At each time step t:

# New infections:
# dI_t ~ Binomial(S_t, 1 - exp(-beta * I_t / N * dt))

# Recoveries:
# dR_t ~ Binomial(I_t, 1 - exp(-gamma * dt))

# State update:
# S_{t+1} = S_t - dI_t
# I_{t+1} = I_t + dI_t - dR_t
# R_{t+1} = R_t + dR_t

Observation model and Bayesian inference:

# Only a fraction of true infections are observed:
# obs_t ~ NegBinomial(mean=rho * dI_t, overdispersion=k)
# where rho = reporting rate, k = overdispersion

# Priors:
# R_0 ~ LogNormal(log(2.5), 0.5)
# gamma ~ Gamma(shape=5, rate=5/5)  # mean recovery time ~5 days
# rho ~ Beta(5, 5)                   # reporting rate

# Inference: estimate posterior p(beta, gamma, rho | observed_cases)
# using SVI, MCMC, or SMC

Regional model with spatial coupling:

# For regions r = 1, ..., R:
# dS_r/dt = -S_r * sum_s (beta_rs * I_s / N_s)
# where beta_rs captures transmission from region s to region r
# beta_rr: within-region transmission
# beta_rs (r != s): between-region transmission (typically beta_rs << beta_rr)

# Coupling can be parameterized by:
# beta_rs = beta_local * (r == s) + beta_travel * mobility_rs
# where mobility_rs encodes travel patterns between regions

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment