Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 46 ยท Vaccines and Immunotherapy

Herd immunity: how immune individuals protect a population

Learn what herd immunity is, derive the threshold 1 - 1/R0, adjust it for vaccine effectiveness, and explore an SIR epidemic model with vaccination.

When most people in a community are immune to an infection, the pathogen struggles to find new hosts. Each infected person meets mostly immune people, so the chain of transmission breaks. This indirect protection is called herd immunity or community immunity, and it shelters people who cannot be vaccinated, such as newborns, people with certain immune conditions, and those whose vaccine did not take.

Herd immunity is a population-level idea, and it is mathematical: it can be calculated. This lesson derives the threshold from the basic reproduction number, adjusts it for imperfect vaccines, and then runs a simple epidemic model so you can see the effect of vaccination on an outbreak.

A curve showing the share of the population that must be immune as a function of R0: 50 percent at R0 of 2, 80 percent at R0 of 5 and about 93 percent at R0 of 15.
The more contagious the infection, the larger the immune share needed.

What you will learn

  • The meaning of R0 and the effective reproduction number.
  • Why the herd immunity threshold is 1 - 1/R0, and how to correct it for vaccine effectiveness.
  • How the SIR model describes an epidemic.
  • Why the threshold is a guide and not a magic line.

Key terms

R0 (basic reproduction number): the average number of people one infectious person infects in a fully susceptible population.

Re (effective reproduction number): the same quantity in the population as it is now, including any immunity.

Herd immunity threshold: the immune fraction at which Re falls to 1.

Vaccine effectiveness (VE): the proportional reduction in infection or disease in vaccinated people in real-world use.

SIR model: a model that divides people into Susceptible, Infectious and Recovered (or removed) groups.

R0 and Re

An infection spreads only if each case produces, on average, more than one new case. R0 measures how contagious an infection is in a population in which nobody is immune and no control measures exist. It depends on the pathogen, but also on how people mix, so it is not a constant of nature. Typical estimates are often given as ranges:

Infection Rough R0 range
Seasonal influenza about 1.2 to 1.4
Early SARS-CoV-2 (original strain) about 2 to 3
Smallpox about 3 to 6
Polio about 5 to 7
Measles about 12 to 18

These figures are estimates, and they vary between studies and places. The practical message is that measles is among the most contagious human infections.

As people become immune, a smaller share of contacts is susceptible, so the effective number falls: Re = R0 ร— s, where s is the fraction of the population still susceptible. The epidemic shrinks once Re is below 1.

The threshold formula

Setting Re = 1 gives R0 ร— s = 1, so s = 1/R0. The fraction that must be immune is the rest:

Text
herd immunity threshold = 1 โˆ’ 1/R0

If R0 = 2, you need 50 percent immune. If R0 = 5, you need 80 percent. If R0 = 15, you need about 93 percent. This is the curve in the figure above.

Vaccines are not perfect. If a vaccine has effectiveness VE, then to reach an immune fraction of 1 โˆ’ 1/R0 you need a vaccination coverage c where c ร— VE = 1 โˆ’ 1/R0:

Text
required coverage = (1 โˆ’ 1/R0) / VE

For measles with R0 = 15 and a vaccine with 97 percent effectiveness (a value typical of two doses), the coverage must be about 0.933 / 0.97, which is roughly 96 percent. This is why public health programs aim for very high coverage, with about 95 percent for two doses of measles-containing vaccine commonly cited as the target.

The SIR model

In 1927, William Kermack and Anderson McKendrick published the first compartment model of an epidemic. Divide a population of size N into S (susceptible), I (infectious) and R (recovered and immune), and let people flow from S to I to R:

Text
dS/dt = โˆ’ฮฒ S I / N
dI/dt =  ฮฒ S I / N โˆ’ ฮณ I
dR/dt =  ฮณ I

Here ฮฒ is the rate at which an infectious person makes effective contacts per day, and ฮณ is the recovery rate (1/ฮณ is the average infectious period). From these equations, R0 = ฮฒ/ฮณ. In the early phase, when almost everyone is susceptible, I grows if R0 > 1. As S shrinks, growth slows, the number of infectious people peaks, and the outbreak declines, even though some people never get infected. Vaccination moves people from S into R before the outbreak, so the initial susceptible fraction is smaller.

If R0 = 4, the threshold is 1 โˆ’ 1/4 = 75 percent. In the simulation below, vaccinating 75 percent or more of the population prevents an outbreak from taking off at all.

A worked example with real structure

Take a town of 10,000 people where measles (R0 = 15) arrives and 90 percent of residents have had two doses of a vaccine that is 97 percent effective. The immune fraction is 0.90 ร— 0.97 = 0.873, so 12.7 percent are susceptible, which is 1,270 people. The effective reproduction number is Re = 15 ร— 0.127 = 1.9, above 1, so an outbreak can grow. If the town raised coverage to 96 percent, the immune fraction would be 0.931, the susceptible fraction 6.9 percent, and Re = 15 ร— 0.069 โ‰ˆ 1.0, right at the threshold. A little more coverage would push Re below 1 and make any outbreak fizzle out.

This example also shows why public health targets are so high for measles: the margin between an outbreak that grows and one that fades is only a few percentage points.

What the threshold does not say

The threshold is a simple, useful number, and it rests on assumptions. It assumes that people mix at random and immunity is spread evenly. In real populations, unvaccinated people often cluster in neighbourhoods or schools, so local pockets can fall below the threshold even when the national average is high. Immunity may wane or the pathogen may change, as influenza and SARS-CoV-2 do. Some vaccines prevent disease better than infection or transmission, which affects whether herd immunity can be reached. A population above the threshold also does not make an infection vanish at once. The decline may overshoot, and new cases can reappear if immunity falls.

Herd immunity is also an argument for equity: the fraction required is a shared goal. Rare people who cannot be vaccinated depend on the others.

Common misconceptions

"Herd immunity is a strategy of letting a disease spread." Herd immunity is a property of a population that can be reached by vaccination. Reaching it by infection would involve cases, and for serious diseases deaths and complications.

"The threshold is the same for every disease." It depends on R0, which varies from slightly above 1 to more than 10.

"Once the threshold is crossed, nobody can get sick." Individuals can still be infected. The threshold means each outbreak will not grow on average.

Try it

The first tool computes thresholds and required coverage. Change the numbers to explore.

JS Herd immunity threshold and required coverage

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second example runs an SIR model with R0 = 4 for different vaccination coverages. Vaccination is modeled as moving a fraction of the population straight to the recovered group at the start, with a perfect vaccine. This is a simplification.

Python SIR epidemic with vaccination

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is the herd immunity threshold for an infection with R0 = 5?

    1 - 1/5 = 0.8, so 80 percent.
  2. 2. If a vaccine is 90% effective and the threshold is 90% immune, what coverage is needed?

    Coverage = 0.90 / 0.90 = 1.0, so even universal vaccination barely reaches the threshold.
  3. 3. In the SIR model, what does R0 equal?

    R0 = ฮฒ/ฮณ: contact rate times infectious period.
  4. 4. Which situation weakens herd immunity even if national coverage is high?

    Pockets below the threshold can sustain outbreaks locally.
  5. 5. What does Re describe?

    Re takes immunity and control measures into account and is the quantity that must be below 1 for an epidemic to shrink.

Summary

  • R0 is the number of secondary cases in a fully susceptible population. Re is the same in the current population.
  • The herd immunity threshold is 1 โˆ’ 1/R0, and the coverage required is that threshold divided by vaccine effectiveness.
  • The SIR model tracks susceptible, infectious and recovered people, with R0 = ฮฒ/ฮณ.
  • The threshold is a guide that assumes random mixing, so clusters and changing pathogens matter.

Next: Cancer immunotherapy