# Simulating epidemics

Below you see a simulation of an epidemic. You can adjust the characteristics of the disease, and the characteristics of human behavior, to see how these affect the course of the epidemic. For example, consider an infection which lasts for 5 days, and which has a 3% probability of transmission. If people have 10 meetings per day, half of the global population will become infected. But if people reduced their interactions to just 6 per day, the epidemic could never even started!

Max infectious: . Min susceptible: .

This is an “SIR model”. “SIR” stands for “Susceptible, Infected, Recovered”. We have a constant population where each person is in one of these three states. Each day, some susceptible people become infected by meeting infectious people, and some infected people recover.

The SIR model is simplistic!
Most obviously, it doesn’t account for *location* or *networks*;
all meetings are between two random members of the global population.
This is a limitation of all “compartmental models”.
And the “states” in the SIR model are also simplistic.
They don’t account for an incubation period,
or for loss of immunity,
or for *carrier* status,
or for death (perhaps the most important state we care about!).

And yet the SIR model shows some important things about epidemics. It shows that the outcome is very sensitive to inputs. I mentioned one at the start: a moderate reduction in the number of meetings can be the difference between a pandemic and an isolated case. Similarly, if we reduced transmission probability from 3% to 2%, perhaps by wearing masks, the epidemic would never get started. Exponential growth is very sensitive to the exponent!

But the SIR model also shows that the epidemic won’t reach the whole population. As people become immune, the exponent drops below 1, because meetings between infected and susceptible people become less likely. In the simulation above, 40% of the population remain susceptible, but the epidemic died before it could reach them.

With Vidrio

With generic competitor

### More by Jim

- A probabilistic pub quiz for nerds
- Time is running out to catch COVID-19
- The inception bar: a new phishing method
- The hacker hype cycle
- Project C-43: the lost origins of asymmetric crypto
- How Hacker News stays interesting
- My parents are Flat-Earthers
- The dots do matter: how to scam a Gmail user
- The sorry state of OpenSSL usability
- I hate telephones
- The Three Ts of Time, Thought and Typing: measuring cost on the web
- Granddad died today
- Your syntax highlighter is wrong

Tagged #programming, #epidemiology. All content copyright James Fisher 2020. This post is not associated with my employer. Found an error? Edit this page.