Mon Mar 30, 2020
Like most of the world right now, my news feed is dominated by one thing. Coronavirus. Every news app or site that I normally scroll through has become a slew of articles about this solitary topic. Some good, some dangerously bad, and some fascinating.
For me, the articles that draw me in the most are ones that present data, and present it well. Tomas Pueyo has written some great articles on Medium that are definitely worth a read, but the main one that caught my eye was this one from The Washington Post. I thought it was amazing that you could so easily see how a virus can spread.
So I set myself the challenge of trying to replicate it and add in parameters that I could input myself and change to simulate different scenarios. I built this simulator using Processing, and you can check out the code here on my GitHub.
Skip to the download
If you’re not interested in any of this article and would just like to download the simulator, you can do so here for Mac and here for Windows. A full list of downloads is available here for other platforms and Windows variants.
Note for Mac: You may need to right click the application and then select “Open” to get it to run.
Note for Windows: If presented with a Windows Defender modal, you can click “More Info” and then a “Run anyway” button should appear which you can click.
Simulating an outbreak
First off, an important point to note is that I am not an epidemiologist, so everything I write here should be take with a decent helping of salt. These are merely my findings from running some simulations with this simulator.
We’re going to run through five simulations in this article, and tweak a few parameters as we do so. You can obviously change the parameters to whatever you like once you’ve downloaded the simulator and run them as many times as you want.
Scenario 1 - Free movement
For the first scenario, we’ll allow the entire population to move while also not slowing the rate of movement for those that become infected. I like to think of this scenario as, hopefully, one of the worst cases. This would be where no containment occurs, even for sick people. Here’s how the simulation looks:
There’s nothing really surprising here. Nearly everyone gets sick, then they all get better. The peak occurs at the start of the simulation, as we would expect to see with no containment measures.
Scenario 2 - Slower movement for infected people
Next up, we’re going to see what it looks like when sick people reduce their movement. Ideally we’d like people who are sick not to move at all. Realistically however, sick people may not even know that they’re sick, and could therefore continue to move. Here we’ll still let the entire population move around, but infected people will reduce their speed by half. That simulation looks like this:
Ok so this actually makes a big difference. We can see that a far larger number of people remain healthy. As a result the peak is also lower. One interesting point is that there are still a number of infected people when the simulation ends. Slowing the rate at which infected people move can reduce the amount of people infected in one go, but we see that the virus still gets around, so much so that we ran out of time for everyone to recuperate.
Scenario 3 - Introducing super spreaders
“Super spreaders” isn’t a scientific term, but it does describe people that may spread the virus on to more than the average amount of people. For the purposes of this simulation, these people move at twice the speed, they can be healthy or infected. Here we’ll still allow everyone to move around freely, infected people will reduce their speed by half, and one quarter of the population will move at twice the speed. Let’s see how it looks:
Surprisingly, this doesn’t look too different from scenario one. We can see that the curve starts slightly earlier this time, but other than that it’s nearly identical. This parameter is an interesting one to play with.
Scenario 4 - Half lockdown
Now let’s start playing with our last parameter. Restricting everyones movement. For this one, we’re going to limit the amount of people that can move to just half. We’ll let infected people to move at the same speed as when they’re healthy, and we won’t have any super spreaders. It plays out like this:
This is a big difference and it’s evident straight away. A large number of people still get infected, but there’s no high peak. Furthermore, this is the largest amount of people we’ve seen remain healthy throughout any of our simulations.
Scenario 5 - Half lockdown and reduced movement of infected people
Now we’re going to keep half of the population on lockdown while also reducing the speed of infected people to half. It looks like this:
This is even better than scenario four. Over one quarter of the entire population remains healthy throughout the simulation, and the peak is the lowest we’ve ever seen it. This is a huge difference
Comparison
Here’s what all the graphs look like stacked together:
Scenario 1
Scenario 2
Scenario 3
Scenario 4
Scenario 5
Conclusion
The conclusion? Stay at home. Stay safe. Stop the spread of the virus.
Spot something wrong? Let me know on Twitter