SIR Epidemic Model

Model epidemic dynamics: see how transmission rate, recovery rate, and R0 shape the outbreak.

Loading interactive simulation...

Lesson

The theory — SIR Epidemic Model

An epidemic has two different endings, and this page prints both. The herd-immunity threshold is the point where each infection stops producing more than one replacement — where the curve turns over. The attack rate is the share of the population that has been infected by the time it is genuinely over. These are not the same number, they are never the same number, and the distance between them is what this lesson is about.

What each symbol means

R₀
the basic reproduction number, β/γ — how many people one infection would produce in a population where everyone is still susceptible. A ratio of two rates, so it describes a pathogen in a setting, never a pathogen alone.
s
the susceptible fraction, S/N. Almost everything below is a statement about this quantity rather than about time, which is why the results are independent of how fast the outbreak runs.
H
the herd-immunity threshold, 1 − 1/R₀: the immune fraction at which growth stops. The page prints it.
A
the attack rate — the fraction ever infected, once I has fallen back to zero. The page prints this too, as "total infected".

Where the formula comes from

  1. Ask when the outbreak grows. The infectious compartment changes as dI/dt = βIS/N − γI, which factorises to I(βs − γ). Since I is positive during an outbreak, the sign is decided entirely by the bracket: infection grows while βs > γ, that is while s > γ/β = 1/R₀. Notice that this is a condition on the susceptible fraction, with no time in it anywhere.
  2. So the turning point is exactly s = 1/R₀, and the fraction no longer susceptible at that instant is 1 − 1/R₀. That is the herd-immunity threshold, and it is the number the page prints — 33.3% for the flu preset, where R₀ = 1.5. It is also where the infection curve peaks, which you can confirm on the graph: the peak is not a coincidence of shape, it is this condition being met.
  3. Now the step that is usually skipped. At the threshold, dI/dt = 0 — but that is not I = 0. There is still a large infectious population standing there, and each of them goes on infecting at rate βs. Fewer than one replacement each, so the numbers fall; but falling from a peak takes time, and every one of those infections lands on somebody. The epidemic does not stop at the threshold. It coasts through it.
  4. To find where it really stops, get rid of time. Divide the susceptible equation by the recovered one: dS/dR = −(β/γ)(S/N) = −R₀s, which integrates to s = s₀·e^(−R₀·r) where r is the recovered fraction. At the end there is no one left infectious, so r∞ = 1 − s∞, and substituting gives the final-size relation: s∞ = s₀·e^(−R₀(1 − s∞)). The attack rate is A = 1 − s∞. It is transcendental — s∞ appears inside and outside the exponential — so there is no closed form, and that is why this page integrates rather than evaluating a formula.
  5. Put the two numbers side by side and the gap is the overshoot. At R₀ = 1.5 the page prints a threshold of 33.3% and a total of 58.5%: the outbreak sails 25 points past the point where it stopped growing. Sweep R₀ and the overshoot is not monotone — it climbs to roughly 30 points near R₀ ≈ 2 and then falls away again, vanishing as R₀ → 1 because nothing much spreads, and vanishing at large R₀ because threshold and attack rate both crowd up against 100%. At R₀ = 5 it is 80.0% against 99.3%; at measles-like R₀ = 15, 93.3% against 100.0%. The worst overshoot sits squarely in the range of pandemic influenza and early SARS-CoV-2.

How to read what you see

Three curves and three numbers. The curves are the compartments; the one worth watching is the infectious hump, whose peak is step 2 happening. Of the numbers, "peak infected" and "total infected" answer completely different questions — the first is how many are ill at once, which is the one hospitals care about, and the second is how many are ill at some point, which is the one the final-size relation predicts. For the flu preset those are 6.4% and 58.5%, and nothing about the first tells you the second. The herd-immunity threshold above them is neither: it is where the first turns over.

Assumes
A closed, well-mixed population — no births, no deaths, no travel, and every susceptible equally likely to meet every infectious person. Constant β and γ, so no behaviour change, no seasons, no interventions partway. Permanent immunity, so nobody returns to the susceptible pool. And a deterministic model, which is why a handful of infectious people always starts an outbreak here — in reality small numbers often die out by chance even when R₀ > 1.
Breaks when
The phrase "herd-immunity threshold" invites a reading the mathematics does not support: that an epidemic left alone ends there. It does not — it ends at the attack rate, which step 5 shows can be 25 points higher. The threshold is a vaccination target, a level you can arrive at without an epidemic; reached instead by infection, it costs you the threshold and the overshoot on top. That distinction was not academic in 2020. Two further cautions for anyone taking these numbers seriously: well-mixed is the least realistic assumption here, and relaxing it generally lowers both the threshold and the attack rate, because the highly-connected people are infected early and stop being bridges; and this page starts from ten infectious individuals rather than an infinitesimal seed, which is why its 58.5% sits just above the 58.3% the classical s₀ → 1 limit gives.

R₀ is a ratio of two rates, so it is never a property of the pathogen alone 🖖

The SIR model splits a population into Susceptible, Infectious, and Recovered compartments. Its dynamics are governed by non-linear ordinary differential equations: dS/dt = -βIS/N and dI/dt = βIS/N - γI. The threshold parameter R₀ = β/γ represents the basic reproduction number. If R₀ > 1, the disease spreads exponentially before reaching herd immunity (S/N < 1/R₀), which forces the infection rate to decay as the pool of susceptible individuals is depleted.

Why outbreaks stop before everyone gets sick 🖖

The infection curve rises, peaks, then falls — but not because the pathogen vanishes. It falls because so many people have already been infected that the virus keeps running into individuals who are already immune. That is why an epidemic burns out long before it reaches everyone: with R₀ = 1.5 only about 58% of the population is ever infected, not 100%.

The threshold theorem came from a blind chemist 🖖

The SIR model was published in 1927 by William Kermack and Anderson McKendrick. Three years earlier, a laboratory explosion had left Kermack completely blind at age 26 — yet he went on to co-derive the epidemic threshold theorem, reportedly working through much of the mathematics in his head. Their paper was largely overlooked for decades before becoming a cornerstone of modern epidemiology.

Problem solved in full

  1. An infection that has R₀ = 3 spreading past the immune fraction 5 steps

    An infection has R₀ = 3. Find the fraction that must be immune to stop it spreading — and show that the epidemic keeps growing past that point.

    1. R₀ is the average number of new cases one case makes in a fully susceptible population: the transmission rate divided by the recovery rate. It is a ratio of two rates, which is why it has no units and no timescale.

    2. An outbreak grows while each case replaces itself. Once part of the population is immune, only the susceptible share counts, so growth continues exactly while that share exceeds 1/R₀.

    3. Invert it. The simulator above prints this threshold, and it is the entire basis of vaccination policy — you never need to reach everybody.

    4. But the threshold is where growth stops, not where the epidemic does. Infected people are still infectious at that moment, so cases keep accumulating past it.

    5. That overshoot is why the peak and the threshold are different numbers, and why an unmitigated epidemic ends with far more than the threshold fraction infected.

    Answer

    66.7%. The peak arrives with about 30% infected at once, and — the point most easily missed — the epidemic continues past the threshold rather than halting there, so the final size overshoots substantially. Herd immunity is a statement about the moment the curve turns over, not about the end of the outbreak. And because the threshold is 1 − 1/R₀, it is brutally sensitive at the top: measles at R₀ ≈ 15 needs 93.3% coverage, which is why measles returns first whenever vaccination rates slip.

Learning path

Growth with a limit

References (3)

Example problems

  • Measles (R₀ ≈ 15) - Measles: extremely contagious (R₀ ≈ 15), leading to rapid outbreaks.
  • Flu (R₀ ≈ 1.5) - Seasonal flu: moderate spread (R₀ ≈ 1.5), peaking in winter months.
  • COVID Delta - COVID-19 Delta: modeled with SEIR incubation phase (R₀ ≈ 5.0).
  • Subcritical - Subcritical case: R₀ < 1.0, disease naturally dies out without epidemic.