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.

WFH on lockdown, like me? Let’s help each other out! I just released Vidrio, a free Mac app to make your screen-sharing awesomely holographic. “Oh damn that's genius”, said some YouTuber when he saw it. But don't believe him, or the #1 on Product Hunt. Instead, believe this demo:

With Vidrio

With generic competitor

More by Jim

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