Simulating an epidemic
3Blue1Brown8 HN recommenders · recommended in 5 months, 2020–2023
explainer · general · 2020–2023 on HN
3Blue1Brown builds toy SIR models to simulate how an epidemic spreads and tests scenarios like social distancing, travel restrictions, central gathering places and quarantine. It was made during the early COVID-19 outbreak.
HN pointed to it during 2020 as a digestible, well-made illustration of epidemic dynamics and interventions.
Up next
3 mo on HNDesert Storm - The Air War, Day 1 - Animated
The Operations Room
2 HN recommender · 2021–2026
7 mo on HNPeter Thiel on "The Portal", Episode #001: "An Era of Stagnation & Universal Institutional Failure."
Eric Weinstein
8 HN recommender · 2019–2024
6 mo on HNThe Biggest Myth In Education
Veritasium
7 HN recommender · 2021–2024
8 mo on HNJim Keller: Moore’s Law is Not Dead
UC Berkeley EECS
7 HN recommender · 2019–2025
6 mo on HNHow Much Do Rockets Pollute? Are They Bad For Our Air?
Everyday Astronaut
6 HN recommender · 2020–2023
5 mo on HNAWS re:Invent 2016: Tuesday Night Live with James Hamilton
Amazon Web Services
5 HN recommender · 2016–2023
2 mo on HNTracy Young Speaks at Female Founders Conference 2015
Y Combinator
2 HN recommender · 2016–2022
2 mo on HNAWS re:Invent 2018: How AWS Minimizes the Blast Radius of Failures (ARC338)
Amazon Web Services
2 HN recommender · 2019–2023
12 mo on HNSugar: THE BITTER TRUTH
University of California Television (UCTV)
13 HN recommender · 2010–2024
11 mo on HNWe Were Taught to Call Death a Blessing
CGP Grey
12 HN recommender · 2018–2025
9 mo on HNDr. Michael Greger | How Not To Die | Talks at Google
Talks at Google
8 HN recommender · 2016–2022
9 mo on HNWhy Some Diseases Only Traveled One Direction
CGP Grey
11 HN recommender · 2015–2024
12 comments from Hacker News
Garrett, thank you. * * * My inspiration for writing this came from watching 3Blue1Brown's YouTube video, "Simulating an epidemic": ▶ this video His simulations cover several scenarios: - Simulating social distancing. - Having people travel to a central location (e.g. a grocery store). - What if the government is able to identify and isolate cases? - Simulating multiple communities with travel, that put quarantine measures in place. - What happens when people get tired of social distancing. * * * Thanks for sharing your code. I see that you are using gnuplot to visualize the output of the script. Have you considered using the csv module ( link ) to output the data, instead of using the print() function? That way, you wouldn't have to manually add in spaces around the data and stringify the numeric data. >>> import csv, sys >>> writer = csv.writer(sys.stdout, delimiter=" ") >>> writer.writerow(["#", "T", "S", "I", "R"]) # T S I R In the script, usage would look something like this: import csv import sys ... writer = csv.writer(sys.stdout, delimiter=" ") writer.writerow(["#", "T", "S", "I", "R"]) writer.writerow([T, S, I, R]) while I > 1000: ... writer.writerow([T, S, I, R])
Part of 3 Blue 1 Brown's excellent latest video simulates travel restrictions and suggests they're not very effective: ▶ this video . However, that was only for cutting travel between all communities by a factor of 4, rather than completely banning travel between two particular communities / countries.
Dynamics of the virus spread is quite interesting. 3Blue1Brown made a fascinating video about how an epidemic spreads: ▶ this video
> Technocrats used complicated mathematical models to determine that mass vaccination would create a "herd immunity" to disease. The SIR model is very simple link At the beginning of the covid19 epidemic everyone and their dog was writing one and publishing a demo version. It was interesting/scary to modify the parameters and see how thing changed. Also, try to fix misinformation in the models, like a 50% death rate. Anyway, a SIR model can be programed in 20 lines of codes, and is pretty straightforward. Adding a vaccine is like 5 additional lines at most. Also, the main idea is very simple to understand. (Someone should write a tutorial of SIR in Excel/GoogleSheets, it's interesting to see the graphics.) The most simple models just assume that everyone meets everyone randomly. It's more complicated if you want to consider a more realistic model of how people move. For a decision about lockdown you need the complex model, but to understand herd immunity the simple model is good enough. For a nice explanation of more complicated models, there is a video of 3Blue1Brown: "Simulating an epidemic" ▶ this video Note that he explains that the models in this video are not 100% accurate, some number are chosen to get nice graphics, they are only useful to get some insight but not get quantitative predictions.
BTW, he's currently co-teaching a course on Julia with some really great lectures on computational thinking: link He also had a nice video about epidemics/pandemics: ▶ this video All using manim for visualizations.
> ...noticeable reduction in the spread? I believe the SIR model [0] answers those questions. 3blue1brown's video on the topic is super digestible and informative [1]. In short, the discovery of a prophylactic if not a therapeutic treatment are our best immediate bets, absent which, quarantines and lockdowns will have to persist to curb the spread of a disease as infectious as covid-19 whilst we patiently wait for an effective vaccine against it [2]. [0] link [1] ▶ this video [2] link
If we can test and isolate, we can manage how the disease progresses through society, with a (very very slight, now) chance of stopping it. While not scientific, this is illustrative and well done that shows many aspects of disease spread: ▶ this video
Homemade masks made of a double layer of tea towel cloth are not only protecting others but also protect yourself nearly as effectively as N95 masks. The original research was made by PHE - Public Health England and the results are: B atrophaeus - ~1um : Surgical mask 96.35% filtering Double layer tea towel 96.71% filtering Bacteriophage MS2 - 23nm : Surgical mask 89.52% filtering Tea towel one layer 72.46% filtering The full paper is on researchgate, title: "Testing the Efficacy of Homemade Masks: Would They Protect in an Influenza Pandemic?" Also every super market should have the use of hand sanitizer obligatory at the entrance. There is a pretty good video for simulations of the epidemic spreading [1] - it is not going to stop until we either have a vaccine or ~60% of the population have antibodies. So the choice is to sit the next 12-18months at home or we fight the transmission of the virus. Masks cost nothing compared to the economic disaster that we are running into. The virus spreads via mouth and nose and secondary via the hands. So just stop it at the source. [1] ▶ this video
OT - 3b1b did an interesting video on the epidemic modeling [0] that shaped my thinking a bit on the lockdown and caused me to lose a few friends to argue against the prolonged lockdowns. I believe he used the same technique deployed by major media institutions and health organizations. Basically the interesting conclusion was unless you apply a very rigorous lockdown (CCP style) the virus ultimately spreads. All you’re doing is spreading the time. As in “flattening the curve”. As some might recall the initial lockdown was proposed as a way to flatten the curve and allow the medical system to cope better by having a more gradual influx of patients. Which makes me think everyone promoting the initial lockdown understood its limitations and its objectives. However, for what ever reason “control demolition” of the economy to make Trump lose the election or who knows why it turned into a long term lockdown. I know this is a controversial topic, but it shouldn’t be. This is a clear case that the science of pandemic modeling suggested one path and for political reasons we were pushed to follow a course that caused a lot of damage, some irreversible, to the society. [0] ▶ this video
I don’t get it. How can social distancing NOT help during a pandemic? Quote from the book 1491: “One reason is that Indians were fresh territory for many plagues, not just one. Smallpox, typhoid, bubonic plague, influenza, mumps, measles, whooping cough—all rained down on the Americas in the century after Columbus. (Cholera, malaria, and scarlet fever came later.) Having little experience with epidemic diseases, Indians had no knowledge of how to combat them. In contrast, Europeans were well versed in the brutal logic of quarantine. They boarded up houses in which plague appeared and fled to the countryside.” And here’s 3Blue1Brown running a simulation: ▶ this video
Not exactly a citation[1], but this agent-based simulation suggest that mitigations like quarantine are highly sensitive to how thoroughly they are applied: ▶ this video [1] I'm putting this firmly in the "all models are wrong, but some models are useful" camp
the whole point of the app is to isolate people that have been in contact with positive cases before they become contagious. if everyone has the app, you won't have an exponential growth. ▶ this video