← Latest papers
🧬 biology

Bayesian Inference in Epidemic Modelling: A Beginner's Guide

This lecture note offers a self-contained introduction to Bayesian inference and MCMC methods for parameter estimation in epidemic models, using the SIR model to demonstrate likelihood derivation, prior specification, and Metropolis-Hastings implementation for graduate students and researchers with limited Bayesian experience.

Original authors: Augustine Okolie

Published 2026-03-17
📖 6 min read🧠 Deep dive

Original authors: Augustine Okolie

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). ⚕️ This is an AI-generated explanation of a preprint that has not been peer-reviewed. It is not medical advice. Do not make health decisions based on this content. Read full disclaimer

🦠 The Big Picture: Guessing the Rules of a Game

Imagine you are watching a video game where a virus is spreading through a crowd. You can see the results (how many people are sick each day), but you cannot see the rules the game is using.

  • The Rules: How fast does the virus jump from person to person? How long does it take for someone to get better?
  • The Problem: The data you see is "noisy." Maybe people forget to report being sick, or the count is wrong because it's a weekend.
  • The Goal: We need to figure out the hidden rules (parameters) that created the messy data we see.

This paper explains how to use Bayesian Inference to solve this puzzle, rather than just guessing a single number.


🧩 Part 1: The SIR Model (The Game Board)

Before we can guess the rules, we need a model of how the game works. The paper uses the SIR Model, which divides the population into three buckets:

  1. Susceptible (S): People who haven't caught the bug yet. They are "vulnerable."
  2. Infectious (I): People currently sick and spreading the virus.
  3. Recovered (R): People who have beaten the virus and are now immune (they can't get sick again).

The Analogy: Imagine a bucket of water (Susceptible) pouring into a second bucket (Infectious), which then drains into a third bucket (Recovered).

  • β\beta (Beta): How fast the water pours from the first to the second bucket (Transmission).
  • γ\gamma (Gamma): How fast the water drains from the second to the third bucket (Recovery).

The paper shows that if we know these two numbers, we can predict the future shape of the epidemic. But we don't know them. We have to find them.


🕵️ Part 2: The Detective Work (Bayesian Inference)

There are two ways to be a detective:

  1. The "Frequentist" Detective: Looks at the evidence and says, "Based on this, the killer is exactly 5'10"." (A single best guess).
  2. The "Bayesian" Detective: Says, "Based on this evidence, plus what I already know about the neighborhood, the killer is likely between 5'8" and 5'11", but there's a small chance they are 6'0"." (A range of possibilities).

The Bayesian Formula:
New Belief=Old Belief×New EvidenceTotal Probability \text{New Belief} = \frac{\text{Old Belief} \times \text{New Evidence}}{\text{Total Probability}}

  • The Prior (Old Belief): Before looking at the data, what do we think? (e.g., "Viruses don't usually kill everyone in one day, so the recovery rate must be reasonable.")
  • The Likelihood (New Evidence): If our guess about the rules were true, how well would it explain the messy data we actually saw?
  • The Posterior (New Belief): The updated guess after combining our old knowledge with the new data.

The Catch: Calculating the "New Belief" directly is mathematically impossible because there are too many possible combinations of rules to check. This is where the magic trick comes in.


🎲 Part 3: The Hiker and the Mountain (MCMC)

Since we can't calculate the answer directly, we use a computer algorithm called MCMC (Markov Chain Monte Carlo). The paper describes this using the Metropolis-Hastings algorithm.

The Analogy: The Hiker in the Fog
Imagine the "Posterior" is a mountain range in thick fog. The highest peaks represent the most likely rules for the virus. You are a hiker trying to find the highest peak, but you can't see the whole mountain.

  1. Start: You stand somewhere random.
  2. Step: You take a small, random step in a random direction.
  3. Check:
    • If you stepped uphill (towards a higher probability), you always take the step.
    • If you stepped downhill, you might still take the step, just to make sure you aren't missing a hidden valley nearby.
  4. Repeat: You do this thousands of times.

The Result: Over time, you will spend most of your time standing on the highest peaks. If you map out where you stood most often, you get a perfect map of the mountain (the distribution of the most likely virus rules).

  • Burn-in: The first few steps of the hike are just you getting your bearings. You ignore those steps and only start counting your position once you are settled near the peak.
  • Trace Plots: These are graphs showing your hiking path. If your path looks like a messy caterpillar bouncing around a spot, you are doing it right. If you are stuck in one spot or drifting aimlessly, the algorithm is broken.

📊 Part 4: What Did We Learn? (The Results)

The paper runs a simulation where they pretend to know the "True" rules (β=0.3,γ=0.1\beta=0.3, \gamma=0.1) and then add "noise" (fake errors) to the data.

They let the "Hiker" (MCMC) try to find the rules.

  • Success: The hiker found the peak! The average of all the steps taken was almost exactly the true values.
  • Uncertainty: The paper shows a "hill" (histogram) for the answer. The hill is very narrow, meaning the data was very clear. If the data were messy, the hill would be wide and flat, meaning "We aren't sure exactly what the rules are, but it's probably somewhere in this wide area."

The "Posterior Predictive Check":
This is the final test. The computer takes 100 random sets of rules from the "hiker's" map and simulates 100 different epidemics.

  • If the real data (the noisy dots) falls comfortably inside the cloud of 100 simulated lines, the model is good.
  • If the real data is way outside the cloud, the model is wrong (maybe the virus doesn't work like the SIR model says).

💡 Key Takeaways for Everyday Life

  1. Don't settle for one number: In epidemics, saying "R0 is 2.5" is risky. Saying "R0 is likely between 2.1 and 2.9" is much more honest and useful for planning.
  2. Use what you know: Bayesian inference lets you mix "common sense" (priors) with "hard data" (likelihood).
  3. Noise is normal: Real-world data is messy. This method is designed to handle that messiness without panicking.
  4. Check your work: Just like a hiker checks their map, scientists must check their "trace plots" and "predictive checks" to make sure their computer didn't get lost.

In short: This paper teaches us how to use a smart computer hiker to explore the foggy mountain of uncertainty, finding the most likely rules for how a virus spreads, so we can make better decisions to stop it.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →