IllustratorsLeak
3blue1brown
3blue1brown

patreon


Simulating an Epidemic (early view)

Hey Everyone,

This is a video (draft) using SIR models to simulate an epidemic and tweak various parameters controlling the small society of wandering dots it applies to.

I'll be doing a properly focused comb through to check for errors tonight, with the plan to publish tomorrow if all looks well.  If you spot anything do let me know!

Once it's live, I'd, of course, be grateful if you found it valuable enough to share.  In the meantime, I'll jump right back into finalizing part 2 of "probabilities of probabilities".

-Grant

Simulating an Epidemic (early view)

Comments

Hey Grant, just wanted to give you a quick heads-up that one of the links in the YouTube description for this epidemic video is broken. The link to the post by Marcel Salathé about contact tracing.

This is very helpful in feeling us have some understanding of the future of this virus in our country which has managed to flatten the infected curve by most of the measures modelled in this video and has a chance of minimizing the effects. 5 million pop. 1,000 confirmed cases 127 cured hovering around 80 new cases each day and at about inflection point of this logistic curve so might top out somewhere around 2,000 cases before we implement the new strategy of letting more people to work and starting the economy in a restricted (2 metre distance) way.

Thanks! This video helped me and my collegues to have a very intuitive understanding of mitigation/supression strategies. Any change to move on a SEIR model?

I think this is a truly great explanatory video RE: Covid19. Well done!

Thank you very much for this amazing video. It looks like the main puzzle we face now is how to exit the quarantine state without collapsing the healthcare system (again). So far I have not seen a sensible solution by the scientific community. I think you could make a big contribution with a similar video showing the impact of different exit strategies. Here's one: start lifting the quarantine by age (and risk) group, i.e. with those less vulnerable first. As soon as this group reaches the top of the infection curve, release the next group, and so on. As the most vulnerable groups start reincorporating to society, the effect of herd immunity should be more and more important. For this, probably the SIR model should be extended to start distinguishing between "recovered" and "dead" (currently 'R'), and between "asymptomatic", "symptomatic", "hospitalized" and "intensive care" (currently 'S'). This would help give a sense of the healthcare system's free capacity, and help figure out which strategy minimizes death and quarantine time.

The best video on this . Thanks Grant !

Having pondered about this for a day I feel there is an issue with the modelling of the particular way social distancing is actually practised and how this is modelled in the present video and in other simulations that have circulated in the recent days. Other simulations around model social distancing by keeping most players static instead of moving. This is, obviously, a very questionable modelling. The present video makes the players actually repel each other. This correctly models the attempt to keep a physical distance while people are on the street. However it ignores the "stay at home" effect. People are mostly staying in a confined space that shields others from the but also them from everybody else. This becomes relevant as soon as you try the situation where people sometimes move to some "hub" where they have an increased risk of getting infected. On their way back home they infect fewer people because almost everybody is shielded in their homes. Also the modelling of the hub as basically a single point where the infection risk is almost 100% might be a little exaggerated. Work places, supermarkets and other "hubs" usually allow for some degree of social distancing. They still hold a higher risk of getting infected (hospitals being the extreme case), but maybe not as much as in the video. Obviously there has to be some limitation in modelling realism due to time constraints. These are just two thoughts on how modelling could improve.

Lionel Pöffel

Great work Grant. Love the info! Love it!

Here's what I wrote in the video description: Thesehttps://github.com/3b1b/manim The source code for this video is visible at the link below, but the, er, awkward part is that it was made on a branch of manim where I'm reworking a lot of other things and have yet to work out all the kinks or add any documentation, so I'm not entirely sure how easy it will be for others to get running. In either case, you should be able to easily see how all the simulations worked. https://github.com/3b1b/manim/blob/shaders/from_3b1b/active/sir.py

3blue1brown

Be sure to check out the numberphile one as well!

3blue1brown

Definitely a worthy question. After two weeks of nonstop intense work on this one, I'm going to take a little breather away from it though :)

3blue1brown

Grant, I wonder what would happen if instead of using some value for a parameter (and adjusting it with a slider to interrogate various scenarios, as you do), you'd implement a probabilistic parameter, such that there is some "mean and sigma" (Gaussian?) for it. I realize, it's just an increased complexity, replacing one parameter with two, but maybe the gain would be an even more "realistic" model? Some of the effects (as you have shown) are rather non-linear, and the "mean and sigma" approach might capture that. Yes, in reality each of those parameters (like time or probability to infect) has a well-defined average for given time frame and scenario, but replacing it with a simple distribution might capture the effects of its variability better, as in reality it is not a constant, even in a given instant of time.

Great video. I sent it to my kids so they will understand the importance of what we are doing! Thanks!

Robin Reagan

Ooooh, with 100% social distancing you get grain boundaries in the population distribution but you don't see it at 90%. Extra credit question: At what point between 100% and 90% do you undergo a phase transition from having grains boundaries to no boundaries?

I'm teaching Advanced Physics Lab online right now and I've had to resort to modeling and data analysis. We just started SIR and you're video is going to save me from having to make a couple of video lectures!!!

But what about masks? https://www.youtube.com/watch?v=BoDwXwZXsDI&feature=youtu.be

Hi Grant - fantastic work as always. Is the code for this type of agent based approach incorporated into the manim ecosystem or is it an external body of work? thanks again

If conferred immunity from COVID-19 is short, people in the "removed" group may revert to the susceptible group. A recent macaque study* suggests immediate reinfection may not be a concern (but the study was small and not on humans), but your models would need to look very different if immunity is shorter than the time for the virus to fizzle out. In those scenarios, it might seem like steepening the curve would help (by quickly burning out the virus before people lose immunity). Of course there will always be stragglers (who evade infection for a longer time) so chances are we'll have resurgence of this infection for years to come just like the flu -- but possibly with more mature immunity built up in society. I wonder if these models then give us false hope -- but they are still very interesting at least mathematically. *https://www.the-scientist.com/news-opinion/monkeys-develop-protective-antibodies-to-sars-cov-2-67281)

Ron Goodman

At 20:17, you might check your use of the word "conflagration," which literally means a huge fire. I love your videos and recommend them to all my students.

One optical thing: The words "Infectious", "Susceptible", "Removed" and their brackets scale with the width of the curves in the flow chart. This sometimes causes them to become very tiny. Maybe they can be kept at mostly the same size without interfering with each other. At least I had the impression that this would be almost always the case.

Lionel Pöffel

Very insightful and much more sophisticated than the simulation demonstrations around. It expressly tackled some of the questions I had about those.

Lionel Pöffel

Fantastic video, Grant. This is true public service, and I'm proud to be a supporter.

Thank you for a thoughtful and informative video. Glad to be a supporter of your work.

I think that would be equivalent to not returning them, since they are «removed» anyway. They might affect the social distancing in this video's simulation, though.

I thought "isolation" was used for people that are infected. While "quarantine" is for people who are expected to be infected, but where this might not be the case. To confuse those two is something you don't want to do on e.g. a cruise ship....

Yes, of course! Subtitling all happens through YouTube's built-in community tools. See this page for more details: https://support.google.com/youtube/answer/6054623?hl=en

3blue1brown

Right...except insofar as the (initial version of) this video talked about R0 in a way that it should have been in reference to R, the "effective" reproductive number. In either case, you're totally right that the value depends on the social dynamics as much as the disease itself.

3blue1brown

You might want to just release this right now, while people are at work and can share with coworkers.

-

I did a similar SIR model myself.. less sophisticated, but I found some of the strongest factors were duration-of-contagion (which I'm not sure is really well established yet for covid-19 -- especially before symptoms start showing up, and people self-quarantine). And also a delay factor between time-of-exposure and beginning the window-of-contagion.. didn't really change the magnitude of the curve much, but even a 3-day lag made it much harder and slower to eradicate from populations

Shawn Van Ness

Upon a second watch, I see that you had two parameters, a "social distance strength" parameter from 0 to 5, and then a "fraction of population" parameter 0 to 1. Since that's what you're varying, maybe make that be the slider? Or remove the slider from the four-panel view to reduce clutter.

Jacob Mirra

Would it be possible to include subtitles in different languages? I would be happy to help with translations into Spanish and Basque.

Daniel Armesto

Well done! This is really helpful.

Doug Fort

I am still confused by the fact that people talk about the 'R0 of the flu' like it's a static and intrinsic property of the disease, yet this video makes it clear that it's also highly dependent on behavioral and environmental factors that can change over time.

Lauren Steely

This is biased by my background in turbulence research. I'm obvisously out of my field here, but I can't help but wonder about these stocastic effects in nonlinear systems.

Gabe

This is great. Something which you touch on briefly, and which I'm very interested in right now is repeatability of the results. I like these simulations (and the others you mention) because you can so easily tweak parameters and add nonlinear events. But the real power of that is that it lets you figure out how things work on average, even when the system is nonlinear, and I haven't seen ANYONE do that kind of analysis. Japan is doing very little to slow down the pandemic, and yet their death rate is very slow. By contrast, Italy enacted very large isolation, but the death rate was huge. There was one major event in Italy, a large soccer match, at just the wrong time. Is it possible that this was enough to account for the difference in the two contries? The deviation between realizations with the same policies but randomly varied underlying conditions needs to be quantified. Otherwise we're likely to assign way too much strength/blame to policy when the truth is that nonlinear systems are just highly variable and bad luck can absolutely defeat a good policy.

Gabe

Beautifully done. I’ll share for sure—people want to learn how to slow this without just being nagged into what to do/not to do. Calming & galvanizing simultaneously, which is quite a feat.

Jacob Ford

11:23 what's going on with the sliders? I think you forgot to differentiate them, because they're all sitting at the "2" tickmark.

Jacob Mirra

Brilliant, you knocked it out of the park.

Excellent video. I believe, but am no expert, that you are using the infection rate parameter R0 incorrectly in at least one part of the animation. I think that R0 is the starting infection rate and as time moves on the changes are to the continuous variable R. Thanks for all the wonderful work, and this one especially!

Me too!

Daniel Armesto

Great video, Since there are so many parameters to change and so many associated graphs, I find my self lost the track of what was the reference graph before changing this parameter. I think it might be a good idea to keep the reference graph always present, so we can compare the effect of changing this particular parameter on the graph.

What I had in mind is that this video should remain relevant many years from now, even with COVID-19 is a thing of the past. To be clear, the only reason I bring up demonetization is not that its something I'm particularly worried about, but because it's something I'm grateful for _not_ being worried about.

3blue1brown

What do you mean?

3blue1brown

Both are worthy suggestions, but I think right now I'm going to go with the sooner-is-better-than later philosophy on posting it and just get it out there. Should I do a follow-up, these are great points. Especially the idea of contrasting ODEs to agent-based models.

3blue1brown

Yup, you are right, it'll be fixed by the public version.

3blue1brown

How about toying with this idea: https://medium.com/@urialonw/containing-sars-cov-2-with-a-two-day-workweek-fbdea4030d30 ? - my intuition says the idea of linear growth of risk is naive, especially for office settings, where we are mostly exposed to the same people most of the time...

Uri Agassi

Whatever changes you decide to make, make them quick, as it is more important to post this video STAT. I hope it lands in some politicians inbox.

For the Fourier transform video you later had a longer one that just showed some of the patterns shown. Could something similar be done for this where a number of simulations are all shown simultaneously to show how much chance affects things? Or how different parameters affect things?

Shaeeyaa

Your previous video prediction of the spread is still tracking correctly. We look to hit 1 million around your prediction or a little sooner. Yikes!

I love the laugh when the dots escape. Keep it in the video.

I noticed you didn't mention COVID19 until 16 minutes, and then only once. If that is the demonitizing trigger, perhaps use a code word, or don't be shy and use it through out the video.

Wow! What an important and timely video. I'm managing the modeling effort for a team of epidemiologists. We are both advising authorities and sharing our work with collaborators around the country who don't have access to modelers. We're planning to expand access to our tools and do more outreach in the next few days. I'll send you an email now.

When discussing the infected population with no symptoms, I think it's highly relevant to talk about the incubation period and the fact that almost everyone who gets it can be simultaneously contagious and asymptomatic for days. This makes a big difference in quarantine modeling.

Alexis Olson

Great video! You touch on this a few times, but the implied variability of the results makes me wary. Around the 12 minute mark, for example, I was surprised that the 70% social distancing case eradicates the disease faster than the 90% social distancing case.

Perhaps accentuating the timeliness of the actions (how soon after the start, or reaching a threshold, of an infection they are put into effect) by direct comparison with similar outcomes (number of total deaths or by proxy number "Removed"). Perhaps an area under the curve in a different color for the fatalities by a percentage of the Removed would be sobering for some viewers.

Gregor Shapiro

I think it could also be nice to spend a little bit of time on whether applying multiple interventions at the same time is more, equal or less effective than the sum of its parts

Job van der Zwan

The WHO suggests using the term "physical distancing", not "social distancing", since it's more clear about what the effort is really about, and is (hopefully) less upsetting. You could use the wide reach of your videos to educate people about that too! https://nerdist.com/article/social-distancing-changed-physical-distancing/

Job van der Zwan

Impressing and somewhat strange that watching this video about an ongoing pandemic can make me feel calm by having soothing background music and Grant's almost hypnotic voice. Really good and pedagogic work!

I agree with your comment. This is what we are currently doing in Italy at the moment.

Yeah, reminds me of the computer simulations used in he first "Lord of the Rings" movie where bots were supposed to fight each other, and some of them just ran away to escape!

The escaping dots are a beautiful moment of levity.

Grant, this is a very valuable video! It would be great if you did a follow on video with actual R0 values of COVID-19 pulled out from data we have on China, Italy and US as case studies. Also it would be quite helpful to see a summary of the various scenarios and sensitivities you explored in one table (or chart) to highlight their relative importance.

I was wondering what would occur if you did modelize the fact that everyone stay at home most of the time, and only goes out once by week for example, for grocery shopping. This way, you can't contaminate more than your housemate most of the time, and only meet one seventh of the population when you do your shopping

arthur milchior

At 8', it was not really clear at start that the isolation was decided box by box.

arthur milchior

It seems extremely strange to me to have "susceptible" in the middle. People goes from suscetible to infectious to removed. So I would expect to have the colors in tihs order. This would show that the infectious people get removed. Each "line" of the graph would then represent a single person. The intuition would be far clearer for me here.

arthur milchior

Hi, really cool video! I have 2 suggestions that may make it even greater: 1) maybe try and visualize the effects of the parameters (e.g., travel percentage, ‘leakiness’) against average outcome variables. Like your current charts of development over time, but directly visualizing the effect of tweaking parameter in one static chart might make the non-lineararities even more apparent. This could be x=leakiness of Isolation, y=expected cases over 30 days. Could also be y=R0. 2) maybe share a few reflections on modelling using a flexible simulation tool as yours vs more traditional approaches using differential equations

I know this video isn't meant to be a PSA about social distancing, but I think it'd be worth emphasizing in the video that flattening the curve is still super helpful, even if the total number of cases ends up being exactly the same long term. What people don't seem to be acknowledging very often is that flattening the curve doesn't stop you from getting infected long term, it just means you wont be infected at the same time as everyone else. This is a key difference because it means hospitals won't be as overwhelmed, which means they can treat better. I guess ideally hospitals wouldn't be the ones doing the treatment since the infected should be quarantined anyway, but the point is if everyone's going at the same time, some people who actually need the treatment to survive won't get it. So it actually can temporarily affect the death rate even if it doesn't affect the total number of cases. It also gives researchers more time to study the virus and work on a vaccine.

It'd be interesting to move the dots from the quarantine zone, once they have recovered, back into the community they came from to track the effects of herd immunity.

I will certainly share this video with everybody!

Daniel Armesto

I am not an expert. Like many others I have become an amateur epidemiologist in the last few weeks. Having said this, I am not sure if you are using R0 correctly. I undertstand it stands for the rate of infection when all individuals are susceptible of infection and no intervention has been made to reduce its growth. I think that what your number represents is more the effective reproduction number, which is the number of actual infections given the current circumstances (number of already removed, pharmaceutical and non -pharmacautical interventions, etc). At least that´s what Wikipedia says (https://en.wikipedia.org/wiki/Basic_reproduction_number)

Daniel Armesto

A much needed video! I really appreciated the insight about the pandemics that never were.

Daniel Armesto

It's not particularly major, but there is a slight jolt in the graphics around 2:52 where the whole screen seems to shift a bit.

Loved it. One small thing I noticed was that when you were talking about key takeaway #4, the graphic above was showing one thing (pretty big difference caused by how long you wait to start restrictions) and the key point was a different thing (that the magnitude of the restriction had a small effect)

This felt the most "Primer" video I've ever made. I almost felt like I was infringing on some kind of trademark :)

3blue1brown

This video was fantastic, and I am already making lists of people I plan to share it with. It would be cool to include something that reflects the fact that mortality rate of goes up if you have infections over a certain threshold.

Tony Ferrell

Hmmm...I think you're right. I'll go and edit that section.

3blue1brown

They really managed to think outside the box :)

Péter Mernyei

I didn't notice any mistakes. Lovely in a lot of ways. I did hear secondhand that YouTube has reversed their stance on demonetizing COVID-19 videos, so perhaps monetizing it would be successful.

Primer

Keep the dots outside of the box. Its cute that they managed to escape! :)

Not exactly, since the red region is not the number of new cases per unit time, but the number who are infectious. This is similar, given that it's essentially the number of cases that were new within the last 5 days (or whatever the infection duration is), but note quite the same.

3blue1brown

Very interesting! There are two tweaks I'd consider, one big and one small. The small one is to have some clearer comparison of the various effects at the end - how eg hygiene seemed to have a really strong effect, as did isolation and testing, just to give some kind of clear "big picture." The other thing is that there's an interesting difference between recovered and dead. You alluded to the non-uniformity of that ratio early on (with hospital overload etc), but I think it would be really interesting to trace that through the simulations. "Total fraction of people who ultimately get infected" is in many ways an uninteresting target metric; it's the number of people who end up with "severe adverse consequences" that's the really key thing to minimize. I'm guessing that (contrary to what many pundits are saying), distancing and so on of the most vulnerable people would not help at all unless it were perfect; even a small failure rate would go badly. And this simulation seems like a great way to explore that!

Yonatan Zunger

I thought R_0 normally referred specifically to the value at the beginning t=0, when everyone's susceptible, and the variable is referred to with just R? I just got that impression from one of the related articles though, so it's very possible that I'm wrong. Great video as always by the way :)

Péter Mernyei

is the line that the border of the grey and blue section makes the definite integral (the area) of the red section? as in is it the accumulative total?

Can't wait for the published version so that I can share it with my friends :) Thanks!

Alipasha Sadri

awesome <3

Quiche

Great job! Honest, humble and enlightening as always. Thanks for everything you do!

This is one of the most amazing and beautiful contributions to our understanding of what is going on right now. Grant, you are a gift beyond words. Thank you!

Testing, testing, testing. It's not just for IT people.

Boudewijn Redeker


More Creators