Simulating an epidemic
Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
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?
What happens when isolation is perfect versus “leaky” in the model?
How do shared central locations (markets or schools) change the effectiveness of social distancing?
Why does reducing travel between communities have limited or inconsistent impact?
How does the model use R and R0 to classify epidemic versus endemic behavior?
What does the model say about social distancing when compliance isn’t universal?
Review Questions
- In this model, what specific parameter changes most strongly increase R, and why does that translate into a faster or sharper epidemic peak?
- 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?
- Why can a central destination undermine social distancing even when close-contact avoidance is applied to most agents?
Key Points
- 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
Perfect early isolation can halt transmission quickly, but even modest testing/quarantine “leakiness” creates long tails and can roughly double total infections.
- 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
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
Travel between communities reduces spread inconsistently; once infection reaches connected hubs, reducing travel alone is not robust.
- 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
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.