Yesterday I posted a Web-enabled version of a model to simulate the spread of a virus under different levels of social distancing.
I realize not everyone has the time or opportunity to download the model and run it themselves.
Also, the version of NetLogo that runs on your laptop has some functions that the Web version can't do. Among those things is that the laptop version can take a particular set of parameter values, run the model a bunch of times, save the results each time, then take a different set of parameter values and again run the model several times.
That allows each run to be random, while still enabling you to see the larger patterns associated with particular parameter values.
In case you didn't get a chance to read yesterday's post, social distancing is captured by reductions in the variable SPEED, which controls how quickly people move around in the world of the model. At lower speeds, people make fewer contacts with other people, which in a crude way mimics the effect of social distancing.
For the graphs below, I set the value for SPEED at 0.2, then 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, and 1.0.
That is, I went from very strong levels of social distancing (speed = 0.2) to no social distancing (speed = 1.0).
At each level of social distancing, I ran the model 20 times.
Each time, I stopped the model after 400 days, or when the virus burned itself out, whichever came sooner.
The model starts with a population of 10,000 people. (The Web version only has 5,000, but the laptop version runs faster, so it's viable to have twice as large an area with twice as many people.)
With new cases per day, the base model (speed = 1.0) sees a peak of almost 90 new cases per day, just shy of 90 days into the spread of the disease.
Out of a population of 10,000, that's almost 1% of the population getting infected in a single day.
If we adopt social distancing down to speed = 0.7, the new cases peak at about 40 per day.
With speed = 0.5, we barely break 10 cases per day (0.1% of the population).
Not surprisingly, this variation in rates of new cases per day translates into vastly different numbers of people sick at any one time.
In the base case (speed = 1.0), the sick population reaches almost 1,800 -- which is almost 18% of the whole population sick at one time.
With speed = 0.7, we keep that to "only" 800.
At speed = 0.5, we hover around 200 for a while before slowly making our way down.
Both of these diagrams illustrate the idea of "flattening the curve."
The third graph shows the total number of people who die from the virus, as that number mounts day by day. With no social distancing, the death toll settles in at around 180 (or 1.8% of the population; see the explanation of the final graph below as to why it settles out).
Increasing levels of social distancing lead to modestly decreasing final death tallies. With speed = 0.6 or 0.5, it's clear the model would have to run for longer than 400 days to see where the total would settle out. But with very stringent measures, the deaths are apparently kept to about 20, or even in the single digits.
The fourth and final graph shows the cumulative number of people who get infected.
With no social distancing, that number levels off at around 8,500, or 85% of the population. The remaining 15% escape because the virus burns itself out: there are so few susceptible individuals around that, even without social distancing, it can't find them in time to keep perpetuating itself. That's why the death toll settles out at about 1.8% of the population, even though in these model runs the virus is assumed to carry with it a 2% chance of death. Less than 2% of the population dies, because the virus itself dies out before it can infect everyone.
The same dynamic is at work with speed = 0.9, 0.8, and 0.7.
For moderately strong social distancing (speed = 0.6, or 0.5), the model needs to run longer than 400 days to see where it will settle out.
At speed = 0.4, the total infected seems to be stabilizing around 1,000 (or 10% of the population.
At very stringent social distancing (speed = 0.3, or 0.2), the virus dies out with no more than a few percent ever having become infected.
On the one hand, it's great that strong social distancing measures can bring about such effective containment of the virus.
On the other, that containment means that the great majority of people are still susceptible. And that in turn means that if you let up on your containment, the virus is still primed to take off.
I'll explore that further in a couple of days, but tomorrow's model will go in a different direction.
One of the observations of CoVID-19 is that its lethality has been between 0.5% and 1% in countries that have kept it contained (e.g., South Korea), while settling in at more like 3% or 4% in places where the spread got away from the authorities (Wuhan, Italy, Iran).
Tomorrow's model adds some detail to show the interaction between the speed with the viral wave hits and the capacity of the medical system to treat people.
A note on NetLogo
NetLogo is a relatively accessible platform for doing agent-based modeling, where you set up a world in a computer by defining the behaviors of the many individual "agents" operating in the world, then you turn it on and see what happens. You tweak the rules of behavior for your individual agents, and you see how that changes the behavior of the world as a whole.
The program is a free download (though they request registration) from their home page at http://www.ccl.sesp.northwestern.edu/netlogo/.
If you've done coding in other languages, you'll probably find it not too hard to learn NetLogo's code.
Even if you're new to coding, you can open up the program, choose a model from the "Models Library", and play around with it (look under the "File" tab).
Or you can download a model, like the one used to produce these data, available at https://drive.google.com/file/d/1tfbuGOe4IrscMcQgV93aw1y83yi4TvPq/view?usp=sharing.
Once you have NetLogo on your computer, if you double-click a NetLogo file, it will automatically open the software and the particular program as well.
In most models, you can click "setup" and then click "go" and just see what happens.
Then you can read the "Info" tab to see what you're doing.
As you get more adventuresome, you can turn to the "Code" tab and see the guts of the thing.
Enjoy!
No comments:
Post a Comment