# 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!

 Infection duration in days Probability of transmission in meeting Meetings per day per person

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.

What can computers do? What are the limits of mathematics? And just how busy can a busy beaver be? This year, I’m writing Busy Beavers, a unique interactive book on computability theory. You and I will take a practical and modern approach to answering these questions — or at least learning why some questions are unanswerable!

It’s only \$19, and you can get 50% off if you find the discount code ... Not quite. Hackers use the console!

After months of secret toil, I and Andrew Carr released Everyday Data Science, a unique interactive online course! You’ll make the perfect glass of lemonade using Thompson sampling. You’ll lose weight with differential equations. And you might just qualify for the Olympics with a bit of statistics!

It’s \$29, but you can get 50% off if you find the discount code ... Not quite. Hackers use the console!

### More by Jim

Tagged #programming, #epidemiology. All content copyright James Fisher 2020. This post is not associated with my employer.