Get AI summaries of any video or article — Sign up free
Simulating an epidemic thumbnail

Simulating an epidemic

3Blue1Brown·
6 min read

Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

In proximity-based SIR simulations, small changes to infection radius or per-contact infection probability can produce large differences in peak size and total cases.

Briefing

Epidemic control in these simulations hinges less on dramatic, late interventions and more on catching infectious people early and reliably. In an agent-based SIR setup—where people move randomly, infection happens when susceptible agents spend time within an “infection radius” of infectious ones, and infectious agents eventually recover—the epidemic can explode quickly, infecting nearly everyone in short order. Small parameter changes produce outsized effects: doubling the infection radius (more interactions) drives the system to a sharp, near-simultaneous peak, while halving the per-contact infection probability (better hygiene) spreads the curve out substantially.

The model also makes a practical point about healthcare capacity: if the peak is too high, mortality rises because systems get overwhelmed. That connects to a recurring real-world feature—people don’t just wander; they converge on shared destinations like schools or markets. Introducing a central location that agents regularly visit can raise the epidemic’s intensity dramatically, pushing the basic reproductive number (R0) as high as 5.8 in the simulation. Even when social distancing is turned on, keeping the central destination active can blunt its benefits, leaving total cases close to the control scenario.

The strongest lever remains identification and isolation of infectious cases. Once the simulation hits a threshold number of cases, infectious agents are removed from the general population one day after infection—standing in for rapid quarantine. Under perfect detection, the epidemic stops quickly. But “leaky” detection changes the story: if 20% of infectious people slip through because they show no symptoms and avoid testing, the peak rises only slightly while a long tail emerges, doubling total infections and prolonging the outbreak. With 50% isolated, outcomes barely improve compared with doing nothing, because enough infectious agents keep seeding new infections.

These dynamics intensify when multiple communities are connected by travel. Cutting travel rates can help in some runs—sometimes leaving entire communities unscathed—but the effect is inconsistent once infection is already present. In larger “cities,” concentrated hubs accelerate spread: once infection reaches a central urban area, it quickly reaches other hubs and then slowly works its way outward.

To quantify spread, the simulations track the effective reproductive number (R), estimating how many secondary infections each infectious person generates over their infectious period. R greater than 1 marks exponential growth (an epidemic), around 1 indicates endemic persistence, and below 1 signals decline. The model’s R values shift sharply with assumptions: R peaks around 2.2 in the baseline, rises to about 8 when infection radius doubles, and sits around 1.3–1.7 when infection probability halves. For comparison, COVID-19’s R0 is cited as a little above 2, while seasonal flu is around 1.3.

Social distancing still matters, especially for flattening the curve, but imperfections prolong transmission. When 100% of agents avoid close contact, the outbreak dies out; when only 70% or 90% comply, total infections remain only modestly reduced and the tail lasts longer. The simulations ultimately argue for layered control: early testing, fast isolation, and effective treatment (modeled as moving people out of the infectious category) outperform reliance on behavior changes alone. If people relax measures while infectious cases remain uncontrolled, the model warns of a second wave—particularly in a world with travel and shared hubs.

Cornell Notes

The simulations use an SIR-style agent model to show how epidemics spread through proximity-based contact and how interventions change the trajectory. Infection spreads rapidly under baseline movement and contact assumptions, and key parameters—especially infection radius and per-contact infection probability—produce large differences in peak size and total cases. Perfect case isolation after a detection threshold can halt transmission quickly, but even modest “leakiness” (e.g., 20% of infectious people not quarantined) creates a long tail and can roughly double total infections. Social distancing flattens the curve, yet small noncompliance prolongs spread, and keeping a central destination active can undermine distancing. The model quantifies growth using R and R0, emphasizing that early, reliable detection and isolation (or early treatment) are the most robust ways to drive R below 1.

Why does changing the infection radius or infection probability so dramatically alter outcomes in these simulations?

In the model, infection risk accumulates when a susceptible agent spends time within an “infection radius” of an infectious agent. Doubling the radius increases the number of people within range dramatically, which in turn can push the effective reproductive number (R) much higher—up to about 8 in the radius-doubled scenario—and produces a near-simultaneous peak where most agents are infected at once. Halving the per-day probability of infection (interpreted as better hygiene like hand washing and cough protection) spreads the curve out: R drops into roughly the 1.3–1.7 range, slowing growth and reducing how quickly the epidemic surges.

What happens when isolation is perfect versus “leaky” in the model?

Once cases exceed a threshold, infectious agents are removed one day after infection in the isolation scenario. With perfect identification and quarantine, the epidemic stops quickly. When 20% of infectious people slip through because they show no symptoms and aren’t tested, the peak rises only a little, but a low long tail appears—meaning it takes much longer to stamp out transmission—and total infections roughly double. When only 50% of infectious people are isolated, the final outcome is only barely better than doing nothing because enough infectious agents remain in circulation to keep seeding new infections.

How do shared central locations (markets or schools) change the effectiveness of social distancing?

A central destination concentrates contacts. Introducing such a hub can raise R0 as high as 5.8, even after a conservative adjustment that halves the daily infection probability to reflect that casual public contact is less intense than close household contact. If social distancing is applied but people still keep going to the central location, the peak may drop slightly, yet total cases remain high—keeping the hub active “defeats” much of the distancing benefit. The model suggests that reducing hub frequency or further lowering infection probability can bring outcomes closer to what you’d get from stronger routine changes.

Why does reducing travel between communities have limited or inconsistent impact?

Agents travel between communities with a daily probability. Cutting travel by a factor of 4 (from 2% to 0.5%) sometimes prevents spread to some communities, but other runs still infect most communities. The timing matters: earlier travel reduction is more effective. Once infection is already present in hubs, contact between communities becomes less of a barrier, and in larger-city settings the hub effect dominates—infecting one urban center quickly spreads to other centers before slowly reaching the edges.

How does the model use R and R0 to classify epidemic versus endemic behavior?

R is computed by tracking how many people each infectious agent infects over their infectious period, then averaging across infectious individuals. R0 is the value of R at the start when nearly everyone is susceptible. In the model, R>1 corresponds to exponential growth (epidemic phase), R≈1 corresponds to endemic persistence, and R<1 corresponds to decline. Baseline runs peak around R≈2.2; doubling infection radius can push R to about 8; halving infection probability yields R around 1.3–1.7.

What does the model say about social distancing when compliance isn’t universal?

Social distancing is modeled as a repulsive force that makes close contact rarer, but not impossible. With 100% compliance, the epidemic dies out. With 90% or 70% compliance, the curve flattens, but total infections remain only somewhat lower than with 50% compliance, and the outbreak lasts longer due to a persistent tail. The key message is that small imperfections in behavior can prolong transmission even if the peak is reduced.

Review Questions

  1. In this model, what specific parameter changes most strongly increase R, and why does that translate into a faster or sharper epidemic peak?
  2. How do “leaky” isolation rates (e.g., 20% or 50% of infectious cases not quarantined) change both the peak and the total number of infections?
  3. Why can a central destination undermine social distancing even when close-contact avoidance is applied to most agents?

Key Points

  1. 1

    In proximity-based SIR simulations, small changes to infection radius or per-contact infection probability can produce large differences in peak size and total cases.

  2. 2

    Perfect early isolation can halt transmission quickly, but even modest testing/quarantine “leakiness” creates long tails and can roughly double total infections.

  3. 3

    Social distancing flattens the curve, yet noncompliance prolongs spread; partial adherence (like 70–90%) may reduce total cases only modestly while extending the outbreak.

  4. 4

    Shared central hubs (schools, markets) can drive R0 much higher and can largely negate distancing benefits unless hub visits are reduced or infection risk at the hub is lowered.

  5. 5

    Travel between communities reduces spread inconsistently; once infection reaches connected hubs, reducing travel alone is not robust.

  6. 6

    R>1 signals epidemic growth, R≈1 indicates endemic-like persistence, and R<1 indicates decline; interventions aim to push R below 1 quickly.

  7. 7

    If measures are relaxed while infectious cases remain uncontrolled, the model warns of a second wave, especially in connected settings with travel and urban hubs.

Highlights

Doubling the infection radius can push the effective reproductive number up to around 8, producing a rapid, near-simultaneous peak where most agents are infected.
Isolation works best when it’s reliable: with 20% of infectious cases slipping through, the peak barely rises but the outbreak stretches into a long tail with about twice the total infections.
A central market or school can raise R0 as high as 5.8; keeping that hub active can defeat otherwise effective social distancing.
Social distancing with imperfect compliance (70–90%) still flattens the curve, but it leaves enough transmission to keep the epidemic burning for much longer.
Reducing travel between communities can help in some runs, but once hubs are infected, the effect becomes limited and inconsistent.

Topics

  • SIR Model
  • Epidemic Simulation
  • Case Isolation
  • Social Distancing
  • Travel Between Communities

Mentioned

  • Harry Stevens
  • Kevin Simler
  • SIR
  • R
  • R0