Pandemic Simulations

COVID-19

Due to COVID-19 I have seen some infection simulations going around the Internet. Most popular (or what I have seen linked to the most) seems to be this simulation from the Washington Post.

I have been wanting to experiment with virus infection simulations for a while now, so now is the time.

Before going further I want to make it clear that this is in no way specific to COVID-19 and I have no professional training in viruses or infections. This is Softology, not Virology.

Simulation Version 1

This version is a blatant ripoff the Washington Post simulation but allows more settings to be tweaked and larger population sizes to be experimented with. People (shown as circles) move around in random directions bouncing off each other.

The simulation starts with all the people healthy (not infected) and a single person set as infected in the middle of the world. These are the settings for the simulation that can be tweaked.

Pandemic Settings

The above default parameters result in the following run. The virus spreads quickly to the entire population. The 50% recovery probability results in roughly half the population dying with the other half recovering from infection.

Now let’s take a look at modifying some parameters.

The next run had increased population density so people are much closer together. The virus now spreads much faster and ends the same as the previous run with a 50/50 dead/recovered ratio.

Now with the density lowered so people are not as packed together. This time the virus does not infect all healthy people. This is a good example of “social distancing” helping.

Lowering the speed at which people move. If infected and healthy people move slower then the virus has less chances to spread. In the end about a third of al people never get infected and another third recover from infection.

Lowering the probability that people will move each step of the simulation to 10%. This could represent the majority of the population staying home and people only going out for essentials. With this change the virus dies out and the impact on the population is minimal.

If the probability of movement is 0 then the initial virus cannot spread and it dies out.

Simulation Version 2

This time I used an even simpler model. People live on a square grid and only move randomly in a north, south, east or west direction.

Here are the default settings this time

Pandemic Settings

Using those parameters gives the following result

Again a higher density population allows the virus to spread much faster

Social distancing can be simulated by lowering the population density to 10%. People are still freely moving around but keeping their distance from each other due to lower density. The virus spreads much more slowly and not all people get infected.

The original settings are run again, but this time there is only a 5% chance people move around each step of the simulation. This models people who are isolating themselves at home. The fewer people who do move around can be thought of as the people who have to go out for food or medicine. This results in the virus barely spreads at all before dying out.

Conclusion

Both of these very simplistic models show clearly that the best way to stop or severely limit a virus spreading is social distancing and self isolation.

If you want to play with these simulations yourself and try tweaking other parameters they are now included in Visions of Chaos.

Another Example

Grant Sanderson aka 3Blue1Brown made the following video about his simulation tests. Much more detailed than my simple tests and as with all his videos highly recommended.

Jason.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s