Medicine & Health ★★☆ Moderate

💉 Herd Immunity

When enough people are immune, an infectious disease can no longer spread — even unvaccinated individuals are protected. The herd immunity threshold is pc = 1 − 1/R₀. Higher R₀ demands higher vaccine coverage. Explore how vaccination halts epidemics with the SIRV model.

❌ Herd immunity NOT reached — epidemic possible
R₀: 3.0 Threshold pc: 66.7% Vaccinated: 50% Peak infected: % Final immune: %

💉 How Herd Immunity Works

Each infected person infects on average R₀ others in a fully susceptible population. If a fraction p is already immune, the effective reproduction number drops to Rₑ = R₀(1−p). The epidemic shrinks when Rₑ < 1:

p_c = 1 − 1/R₀    (herd immunity threshold)

Measles (R₀ ≈ 12–18) requires ~95% coverage. COVID-19 (R₀ ≈ 2–4) needs ~50–75%. Influenza (R₀ ≈ 1.3–2) needs only ~25–50%. The SIRV model splits the population into Susceptible, Infected, Recovered, and Vaccinated compartments, tracking flows between them over time.

About Herd Immunity Simulator

Herd immunity occurs when a sufficient proportion of a population has become immune to an infection — through vaccination or prior illness — so that the disease can no longer spread efficiently. Even individuals who are not themselves immune benefit because the chains of transmission are broken before the pathogen can reach them. This indirect protection is critical for people who cannot be vaccinated, such as newborns and immunocompromised patients.

The herd immunity threshold (HIT) is determined by the basic reproduction number R₀: HIT = 1 - 1/R₀. For measles with R₀ ≈ 15, approximately 93% of the population must be immune to halt transmission. For COVID-19 with R₀ ≈ 2.5–3, the threshold is around 60–70%. The simulator models this using SIR (Susceptible–Infected–Recovered) compartmental dynamics.

Maintaining herd immunity requires sustained vaccination coverage. Vaccine hesitancy, waning immunity, and the emergence of new variants can erode it. Public health campaigns, booster programmes, and outbreak monitoring are essential tools for keeping community immunity above the threshold and preventing resurgent epidemics.

Frequently Asked Questions

What is the herd immunity threshold and how is it calculated?

The herd immunity threshold (HIT) is the minimum immune fraction needed to stop an epidemic: HIT = 1 - 1/R₀. For R₀ = 4, HIT = 75%; for R₀ = 10, HIT = 90%. Higher transmission diseases require higher immunity coverage.

Can herd immunity be achieved through natural infection alone?

Technically yes, but natural infection herd immunity comes at enormous cost in illness, death, and long-term complications. Vaccination achieves the same protective threshold safely and quickly, which is why it is the recommended public health strategy.

Why do some diseases fail to achieve herd immunity despite high vaccination rates?

Some diseases persist because vaccine coverage is uneven (creating pockets of susceptible individuals), immunity wanes over time, or new variants can partially escape immunity. Measles outbreaks have occurred even in high-coverage countries when local vaccination rates drop below 95%.

Does herd immunity protect vaccinated individuals too?

Yes. Even vaccinated individuals benefit from herd immunity because lower community transmission reduces exposure. No vaccine is 100% effective, so fewer circulating pathogens mean vaccinated people face less risk of breakthrough infections.

What is the SIR model used in epidemiology?

The SIR model divides a population into Susceptible, Infected, and Recovered compartments, described by differential equations. It captures how infection spreads and wanes over time, and forms the foundation for more complex models including SEIR (with an Exposed class) and agent-based simulations.

Why does moving the R0 slider so strongly change the required Vaccination % for herd immunity?

The herd immunity threshold is HIT = 1 - 1/R0, which is highly sensitive at low R0 and flattens out at high R0. Moving R0 from 2 to 4 raises the threshold from 50% to 75%, while moving it from 10 to 18 only raises the threshold from 90% to about 94.4% — this is why highly transmissible diseases like measles (R0 around 15-18) need extremely high vaccination coverage just to cross the threshold.

What happens in the simulation if the Vaccination % slider is set above the herd immunity threshold?

Once Vaccination % exceeds 1 - 1/R0 for the chosen R0, the effective reproduction number drops below 1, meaning each infected person on average infects fewer than one other. In the simulation this shows up as outbreaks that fail to take off: a small cluster of cases may appear near the initial seed, but the chain of transmission dies out on its own instead of spreading through the population.

How does the Infectious days slider affect how fast herd immunity protection kicks in during a simulated run?

Infectious days (2 to 21) sets how long each infected individual can transmit before recovering. A longer infectious period means each case has more opportunities to encounter susceptible people before removal, so for the same R0 and vaccination level, outbreaks with a longer infectious period take more simulated time steps to either die out or spread, even though the herd immunity threshold itself depends only on R0.

Why is the herd immunity threshold expressed as a fraction of the population rather than a fixed headcount?

Because R0 itself depends on the average number of contacts per person, which scales with the size and density of the population, the herd immunity threshold 1 - 1/R0 is a proportion, not an absolute number. Whether a town has 10,000 or 10 million residents, the same fraction of the population (determined purely by R0) must be immune before transmission chains can no longer sustain themselves.

Does herd immunity threshold change if a disease has a higher fatality rate?

No — the herd immunity threshold formula HIT = 1 - 1/R0 depends only on how transmissible the disease is (R0), not on how severe or deadly it is. A highly transmissible but mild disease can require a very high vaccination threshold, while a highly lethal but poorly transmissible disease (low R0) may need only modest coverage to stop spreading, which is why R0 and fatality rate are tracked as separate, independent properties of a pathogen.