Epidemic models explained
An epidemic looks chaotic from the inside, yet its overall shape follows a few simple rules. Divide the population into the susceptible, the infected and the recovered, say how fast people pass from one group to the next, and a slow start, a steep rise, a peak and a long tail all follow. The same handful of formulas tells you how fast an outbreak doubles, how many people it reaches in the end and how many must be immune to stop it.
From Bernoulli to Kermack and McKendrick
Mathematics met epidemics early. In 1760 Daniel Bernoulli calculated how much inoculation against smallpox would raise life expectancy. In 1906 William Hamer explained the regular waves of measles in London by assuming that new cases are proportional to the number of susceptible people times the number of infected people, the law of mass action borrowed from chemistry. Ronald Ross used the same idea for malaria and showed that it is enough to push the mosquito population below a threshold, not to wipe it out. In 1927 William Kermack and Anderson McKendrick put it all into one model, published in the Proceedings of the Royal Society, and fitted it to the plague epidemic in Bombay of 1905 and 1906. Their model, now called SIR, is still the starting point of almost every epidemic model.
The SIR equations
Everyone is in one of three groups: S susceptible, I infected (and infectious) or R recovered (or removed, immune either way). With N people in all, the model says dS/dt = −β S I / N, dI/dt = β S I / N − γ I and dR/dt = γ I. An infected person meets people and passes the virus on at rate β, but only the share S / N of those contacts is still susceptible. Infected people recover at rate γ, so they are infectious for 1/γ days on average. In the simulator β is the infection chance per contact times the number of contacts per person per day, which it counts: 9% × about 4 contacts gives β = 0.36 per day, and a recovery time of 7 days gives γ = 1/7 ≈ 0.143 per day. The dashed curves are these equations, solved step by step with the Runge–Kutta method.
R₀, the basic reproduction number
R₀ = β / γ is the number of people one case infects in a population where everyone is susceptible: the infections per day times the days infectious. With β = 0.36 and γ = 1/7 it is 0.36 × 7 ≈ 2.5. As the epidemic goes on, fewer contacts are susceptible and each case infects Rₜ = R₀ × S / N people, the effective reproduction number. The outbreak grows while Rₜ is above 1 and shrinks once it falls below 1. Commonly quoted values of R₀ are about 1.3 for seasonal flu, 2 to 3 for the 1918 flu and the first variant of SARS-CoV-2, 5 to 7 for smallpox and 12 to 18 for measles. R₀ is not a property of the virus alone: it depends on how often people meet, so it differs between places and times.
Exponential growth and the doubling time
At the start nearly everyone is susceptible, S / N ≈ 1, and the equation for the infected becomes dI/dt ≈ (β − γ) I. Its solution is exponential growth, I(t) ≈ I₀ e^((β − γ) t), with a doubling time of ln 2 / (β − γ). For β = 0.36 and γ = 1/7 that is 0.693 / 0.217 ≈ 3.2 days: three initial cases become about 100 in just over two weeks and 1,000 some ten days later. On a logarithmic scale exponential growth is a straight line whose slope is the growth rate, which is why epidemic charts are often drawn that way. The growth slows long before the peak, because every infection uses up a susceptible person.
The peak and the final size
The number infected peaks when S / N has fallen to 1/R₀, the moment Rₜ reaches 1. Starting from an almost fully susceptible population the peak is 1 − (1 + ln R₀) / R₀ of everyone at once: 23% for R₀ = 2.5. The epidemic does not stop there; it runs on while the infected still infect, and the share z that is ever infected solves the final size equation z = 1 − e^(−R₀ z). For R₀ = 1.5 that is 58%, for R₀ = 2 it is 80% and for R₀ = 2.5 it is 89%. An unchecked epidemic therefore overshoots: it infects far more than the 60% that would have been enough to stop it. Some people are never infected at all, because the virus runs out of chains to spread along before it reaches them.
Herd immunity and vaccination
If a share v of the population is immune from the start, each case infects R₀ (1 − v) people at first. That is below 1 once v exceeds 1 − 1/R₀, the herd-immunity threshold: about 60% for R₀ = 2.5 and 92% to 95% for measles, which is why measles needs such high vaccination coverage. Above the threshold a few cases can still occur, but each chain of infections dies out instead of exploding, so the people who cannot be vaccinated are protected too. A vaccine that protects only a share e of those who get it needs a coverage of (1 − 1/R₀) / e. Below the threshold vaccination still lowers the peak and the final size, as the dashed model curves show.
Chance: stochastic versus deterministic
The SIR equations are deterministic: the same start always gives the same curve, and any R₀ above 1 gives an epidemic. Real outbreaks start with a few people, and then chance matters. A first case may recover before it infects anyone, and in the classic model a single case starts a major outbreak only with probability 1 − 1/R₀, 60% for R₀ = 2.5; with three cases the chance that all three chains die out is about (1/R₀)³ ≈ 6%. Such fade-out is described by branching processes. The simulator is a stochastic, agent-based model: every person walks, meets and recovers by chance, and contacts are local rather than perfectly mixed. That is why its curve wobbles around the model, sometimes starts late or stops after a handful of cases, and lies closer to the model the more people there are.
What distancing does
Distancing lowers the number of contacts per person and with it β and R₀. In the simulator the people staying home do not move, and two people who both stay home never meet, so the contacts fall to about 1 − h² of the original when a share h stays home: with half the population at home R₀ drops from 2.5 to about 1.9, the peak comes later and lower and fewer people are infected in the end. This is what flattening the curve means: fewer sick people at the same time, so that hospitals can cope. To push R₀ below 1 with R₀ = 2.5 to begin with, the contacts must fall by more than 60%.
Explore it
Open the epidemic simulator and press Play: watch the first red dots, each with its contact zone, set off an outbreak, and compare the solid curves with the dashed SIR model. Turn on Log scale to see the early exponential growth as a straight line; the Day tile gives the doubling time while the outbreak grows. Change the infection chance and the recovery time and watch R₀; set Vaccinated above the herd-immunity threshold in the Infected in total tile; let people stay home; and press New run a few times with one initially infected person to see how often the outbreak fades out by chance. The pencil opens the picture in the photo editor with the arena, each group of people, each curve and the model on layers of their own.
Frequently asked questions
What is the SIR model?
A model of an epidemic in which everyone is susceptible (S), infected (I) or recovered (R). Susceptible people are infected at a rate proportional to the number of infected, and infected people recover at a constant rate. William Kermack and Anderson McKendrick published it in 1927.
What does R₀ mean?
The basic reproduction number: how many people one infected person infects on average in a population where everyone is susceptible. In the SIR model it is β / γ, the infection rate times the mean infectious period. An outbreak can grow only when it is above 1.
How is the herd-immunity threshold calculated?
As 1 − 1/R₀. Once that share of the population is immune, each case infects fewer than one other person on average and outbreaks die out. For R₀ = 2.5 it is 60%, for measles with R₀ around 15 more than 90%.
Why does an outbreak sometimes stop on its own?
By chance. When there are only a few cases, they may all recover before passing the virus on, even if R₀ is above 1. In the classic model a single case leads to a large outbreak with probability 1 − 1/R₀ only.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Open the epidemic simulator