I want to share with you a few toy simulations
that model how an epidemic spreads. There have recently been a few wonderful interactive
articles in this vein, including one in the Washington Post by Harry Stevens, and one
by Kevin Similer over at Melting Asphalt; they’re great, you can play with them, it’s
very informative, and of course I’ll leave links in the description. After seeing those I had a few more questions. Like, if people stay away from each other
I get how that will slow the spread, but what if despite mostly staying away from each other
people still occasionally go to a central location like a grocery store or a school? Also, what if you are able to identify and
isolate the cases? And if you can, what if a few slip through,
say because they show no symptoms and aren’t tested? How does travel between separate communities
affect things? And what if people avoid contact with others
for a while, but then they kind of get tired of it and stop? We’ll explore these questions and more,
but first let’s walk through how exactly our models will work. These simulations represent what’s called
an “SIR model”, meaning the population is broken up into three categories, those
who are susceptible to the given disease, those who are infectious, and those who have
recovered from the infection. The way I’ve written them, for every unit
of time a susceptible person spends within a certain “infection radius” of someone
with the disease, they’ll have some probability of contracting it themselves. So we’re using physical proximity as a stand-in
for things like shaking hands, touching the same surfaces, kissing, sneezing on each other,
all that good stuff. Then for each infectious person, after a given
period of time, they’ll recover and no longer be able to spread the disease. If they die, they also won’t be able to
spread it anymore, so as a more generic term sometimes people consider the “R” in “SIR”
to stand for “removed”. This should go without saying, but I’ll
emphasize it anyway: These are toy models, with a tiny population, inevitably falling
far short of the complexities in real people and larger populations. I’m no epidemiologist, so I’d be very
hesitant to generalize any of the lessons here without deeper consideration. That said, I think it can be healthy to engage
the little scientist inside all of us and take the chance to be experimental and quantitative
even if it’s in a necessarily limited fashion, especially if the alternative is to dwell
on headlines and uncertainty. Establishing simulations
We’ll start simple and layer on more complexity gradually. In these first runs that you’re seeing,
everyone just meanders about the city, and the infection follows the rules we’ve laid
out. So... it’s not looking great. It doesn’t take too long before almost everyone
gets infected. As a sanity check, what would you expect to
happen if I double this radius of infection? You might think of this as representing more
total interactions between people; a more socially engaged society. It’ll spread more quickly, of course, but
how much? It’s actually very dramatic! Within a short span the majority of our little
population is infected simultaneously. As another sanity check, what do you expect
if we go back to the original infection radius, and then cut the probability of infection
in half? Remember, for each unit of time a susceptible
person is within the infection radius of an infectious person, they have some probability
of becoming infected, which by default I have set to 20%. This is the number we’re cutting in half
now. You could think of this better hand washing,
cough protection, and less face touching. As you might expect, it spreads out the curve. In fact, it does so by quite a lot, really
illustrating how changes to hygiene can have very large effects on the rate of spreading. The first key takeaway to tuck away in your
mind is just how sensitive this growth is to each parameter in our control. It’s not hard to imagine changing your daily
habits in ways that multiply the number of people you interact with or that cut your
probability of catching an infection in half; but the implications for the pace of this
spread are huge. The goal is probably to reduce the total number
of people who die, which is some proportion of this “removed” category in the end. That proportion is not a constant, though. If you get to a point where the peak of this
infection curve is too high, meaning there’s a time when many people are sick at once,
that’s when available healthcare resources are overwhelmed, increasing that mortality
rate. Now, I don’t know where you’re from, but
in most towns, people don’t actually spend their days drunkenly wandering through the
city like this. Often there’s a common destination, like
a central market or a school, that people need to go to. In our model, if we introduce a central spot
like this that people regularly visit then return from, it’s...well...just look. One of the main things I was curious about
is how to mitigate this effect. We’ll examine that in just a bit. Another feature we could include is to have
a few separate communities, with travel between them. Every day, each person will have some probability
of traveling to another community, where they arrive at a central location. That’s our basic setup, now what actions
help to stop this spread? What’s most effective is to identify and
isolate whoever is infectious, for example with good testing and quick responsiveness. For our simulations, once we hit some critical
threshold of cases, we’ll start sending people to a separate location 1 day after
they get the infection. This is, of course, just a stand-in for whatever
isolation would look like in the real world; it doesn’t have to literally be transporting
all the sick people in one sad box. Unsurprisingly, this totally halts an epidemic
in its tracks. But what if when you’re infected, you have
a 20% chance of not getting quarantined, say because you show no symptoms and don’t get
tested, so you go about your day as usual? We’ll illustrate these people who have no
symptoms with yellow circles instead of red. Obviously this will have a result somewhere
between the total quarantine and doing nothing, but where on that spectrum would you predict
it will be? The peak number of cases at the same time
is only a tiny bit higher, but there’s a long tail as it takes much longer to stamp
out, resulting in about twice as many total cases. This gets more interesting when we do it in
the setting with many communities and travel between them. Again, totally effective tracking and isolation
stops the epidemic very effectively, but what do you predict will happen if 20% of infectious
cases slip through this process? Again, I’ve set things to wait until a certain
critical threshold of cases is hit before our little dot society kicks into gear and
takes action. Even when all the parameters are the same,
it’s interesting that in some runs it can take around three times longer to reach this
point than others; before the law of large numbers kicks in, the pace of growth can have
as much to do with a role of the dice as it does with anything intrinsic to the disease
itself. It does keep the curve flat, but now it’s
a much thicker tail during the long time it takes to track all the cases, with over half
the population getting affected this time. What would you predict if only 50% of infectious
cases are isolated like this? If half the infectious population is getting
quarantined, it doesn’t mean half the total population will end up with the disease. Because there are still so many agents out
there spreading it, we end up with a situation that’s only barely better than if nothing
had been done at all. A second key takeaway here is that changes
in how many people slip through the tests cause disproportionately large changes to
the total number of people infected. The fact that quickly containing cases early
is so effective has an interesting corollary, which is that the most lethal diseases are,
in some sense, less dangerous globally. Remember that the rule in these quarantine
simulations is to send infectious people to a separate location one day after they’ve
been infected. But if the disease kills its host in one day,
the model looks identical, it just has a much darker interpretation. It’s terrible for those who get it, but
it doesn’t spread. It also means that the most dangerous viruses
are the ones that kill some part of the population, while laying unnoticed and spreadable among
others. Or worse yet, if they remain unnoticed and
spreadable in everyone before becoming lethal. One of the reasons the SARS outbreak in 2002
was so well contained is that just about everyone in this infectious population was showing
symptoms, and so were easier to identify and isolate. A more optimistic corollary is how useful
early treatment can be. If there exists an antiviral therapeutic that
can move people out of this infectious category quickly, it has the same effect on the model
as isolating those cases. But let’s say you don’t have widespread
testing, or antiviral therapeutics. We’ll introduce a new parameter here, which
is how much people try to avoid each other. Let’s call it the “social distance factor”. In these animations, I’ll apply it as a
repulsive force between people, and have them glow yellow when they feel a little too close
to their neighbor. This has the sad-but-cute effect that when
our little agents are social distancing, they often end up trembling near the edge. No isolation is perfect, though, so every
now and then even those repulsed by others will jiggle close enough
to get infected; the point is that it’s much rarer. Let’s take a look at four separate runs
here. In each of them, after they hit 50 cases,
we’ll turn on social distancing. For the top left, we turn it on for everyone,
in the top right, we turn it on for 90% of the population. In the bottom left, 70%, and in the bottom
right, 50%. What do you think will happen? As you might expect, when 100% of people avoid
each other, the disease quickly goes away entirely. In all four cases, the presence of widespread
social distancing absolutely flattens the curve. However, in terms of the long-term number
of cases, the run with 70%, and even the one with 90%, end up with a little less than half
the population ultimately getting infected, and the run with 50% is only a little bit
worse than that. The case with 90% of people repelled by all
others takes longer to get there, but evidently a mere 10% of the population cheating adds
enough instability to keep the fire slowly burning for a long time. Again, I’ll emphasize these are toy models,
and I leave it to the intelligence of the viewer to judge if the behavior of these dots
accurately reflects what social distancing would mean for you and your life. Someone fully sequestered to their home is
not necessarily affected by the random jigglings of their neighbor. But then again, few people live genuinely
independently from everyone else. Insofar as these models aren’t outlandish,
the third key takeaway is that social distancing absolutely works to flatten the curve, but
even small imperfections prolong the spread for a while. Now let’s look at our setup with 12 communities
and travel between them. By default, I have it set where every day
each agent has a 2% chance of traveling to the center of a different community. Let’s try a run where once we hit 100 cases,
we cut down this travel rate by a factor of 4, to only half a percent. What do you think will happen? The honest answer is that it depends. In some runs, it doesn’t make any difference
and the majority of every community gets it. Other times, a few communities end up unscathed. In general, the earlier you turn this on the
more effective it is, but the takeaway here is that reducing contact between communities
has only a limited effect once many communities already have it. As a side note, when we run these simulations
with larger cities, which has the effect that the city centers act like concentrated urban
hubs, you can see how once the infection hits one urban center, it very quickly hits all
of them, and slowly spreads to the edges from there. Let’s take a moment to talk about how to
quantify the rate of this spread. Consider one person with the disease, and
count how many other people they infect while they have it. The average for this count across everyone
who has been sick is known as the effective reproductive number, or R. A more commonly discussed number is R_0, which
is the value of R in a fully susceptible population, like at the very beginning. This is called the “Basic” reproductive
number. You may notice I’ve had this label on the
simulations, where the way it’s calculated is to look at each individual who is currently
infectious, count how many they’ve infected so far, estimate how many they’ll infect
in total based on the duration of the illness, then average those numbers. For example, in our first default simulation
with no added spices, R is around 2.2 in the highest growth phase, before falling down
as the population becomes saturated. By contrast, when we doubled the infection
radius, R was as high as 8! That factor has a huge effect on the growth
rate, hence the explosive spreading. This kind of makes sense; when you double
that radius, there’s about 4 times as many people inside it to infect. When we chopped the infection rate in half,
it hovered around the 1.3 to 1.7 range. While R is greater than 1, the infection is
growing exponentially, and is known as an epidemic. If it holds steady around 1, it’s called
“endemic”. And less than 1 means it’s on the decline. For comparison, R0 for COVID-19 is estimated
to be a little above 2, which is also around the mean estimate for R0 during the 1918 Spanish
flu pandemic. The seasonal flu, by comparison, is much lower,
around 1.3. For our toy epidemic in the travel case, when
we turn on social distancing and shut down travel, you can see R quickly drop down from
2. Like I said at the start, one of the things
I was most curious about is the effects of some kind of shared central location, like
a market or a school. When I introduce such a destination for our
little dots, R jumps up as high as 5.8. This might be a little unfair, since it puts
everyone right in the same spot, and given that we’re using physical proximity as a
stand in for things like shaking hands or kissing, we should acknowledge that people
going to the same school or grocery store are not as likely to spread an infection as,
say, people living in the same house. To account for this let’s cut the probability
of infection per day in half. This does indeed cut the peak value of R in
half, but the effect of a central market remains dramatic. Let’s try a run where after some threshold
is hit, we turn on social distancing, but people still go to the central location as
usual. You may have noticed that some of the dots
have escaped their little cage...which was not supposed to happen, but I’m gonna make
the conscious choice not to fix that. It’s like they all looked at the chaos inside
and went “Nope, I’m out! I don’t want any part of that!”. Living in the Bay area during a shelter-in-place
order, I can confirm this is how some people react. Wandering dots aside, though, let me show
you how this graph compares to the control, and how it compares to what would have happened
if in addition to repelling away from each other, all the dots also stopped going to
the central location. The peak of the infection curve is a bit lower
than the control, but in terms of total number of cases, keeping that central location active
really defeats the effects of social distancing. Now what do you think will be more effective,
if on top of the social distancing we decrease the frequency with which people go to the
central spot by a factor of 5? Or if we chop the probability of infection
down by another factor of 2, for example meaning people practice better hygiene? Well, let’s play them both out. The left here requires our dots to heavily
alter their daily routines, whereas the right involves people continuing their usual habits
while being much more conscious of hygiene. They’re actually nearly identical, which
surprised me, given that one of them is a fivefold increase and the other is twofold. I guess it goes to show that more effective
hygiene, which is maybe easier said than done, goes a long way. Of course, it doesn’t have to be an either
or; our goal with these experiments is to look at the effects of one change at a time. If you’re curious, here’s what it looks
like where we apply social distancing, restrict the rate that people go to the central location,
and also lower the infection rate, all at once. The combination of them all is, indeed, very
effective. But I want to emphasize again how the most
desirable case is one where you can consistently identify and isolate cases. Even in this central market simulation, which
left unchecked gives a huge conflagration, being able to do this effectively really halts
the epidemic. And our little dots don’t even have to be
repelled by each other or stop their trips to the market. In real epidemiology it gets more sophisticated
than this, with tactics like “contact tracing” where you not only identify and isolate known
cases, but you do the same for everyone who’s been in contact with those cases. Given the time I’m posting this, I imagine
there’s some expectation for it to be a PSA on social distancing. But to be honest, that’s not really my own
main takeaway. To be clear, when it’s needed, like it is
now, social distancing absolutely saves lives, and as we saw earlier when people cheat, or
continue regularly meeting in a central spot, it has disproportionate effects on the long-term
number of cases. The uncomfortable truth, though, is that while
the disease still exists, as soon as people let up and go back to their normal lives,
if there’s nothing in place to contain the cases you’ll just get a second wave. After making all these, what I came away with
more than anything was a deeper appreciation for disease control done right; for the inordinate
value of early widespread testing and the ability to isolate cases; for the therapeutics
that treat these cases, and most importantly for how easy it is to underestimate all that
value when times are good. I’m writing this during a pandemic, when
some viewers may be able to identify all too well with the trembling dots retreating to
the edge of their box. But in the future many people will be watching
it during a pandemic that never was; a time when a novel pathogen that would spread widely
if left unchecked is instead swiftly found and contained. Those would-be pandemics never make it into
the history books, which is maybe why we don’t value the heros behind them the way we should. Living in a world with widespread travel and
vibrant urban centers does make fighting the spread of a disease an uphill battle, it’s
true. But that same level of connectedness means
ideas spread more quickly than ever, ideas that can lead to the systems and technologies
which nip outbreaks in the bud. It won’t happen on it’s own, and it’s
clear that we sometimes make mistakes, but I’m fundamentally optimistic about our ability
to learn from those mistakes. As you might imagine, these videos require
a lot of hours and effort. I don’t do ad reads at the end, and YouTube
content related to the current pandemic seems to be systematically demonetized, so I just
wanted to take this chance to say a particularly warm thanks to those who support them directly
on Patreon. It really does make a difference.
..every 2-4 weeks
They need to test everyone’s antibodies and release them to work!
That's a great channel overall btw
Is there a logistical reason we can't create enough tests that every American can be tested multiple times? I'm talking literally 2 or 3 billion tests. Is that feasible?
And I don't necessarily mean financially.
Very interesting video. I guess it's not surprising how much good hygiene helps, but could you ever trust that all your neighbors are actually washing their hands and effectively covering their coughs? Guess we won't be going to the grocery store for a while...
My takeaway from this is that (according to this simulation) social distancing means pretty much nothing if stores are still open
and we can't close stores.
so uh...
we're fucked?
You do know tests are not 100% accurate. Depending on tests, it ranges from 35 % to 95 % and there are a lot of human errors.
Lol, no, that's a stupid argument, there are recovered patients who had no symptoms and were tested negative then positive, and then there are tons of asymptotic carriers you may not accurately test
Or wear masks