Christopher Belanger, PhD MBA Posts Projects Publications CV Contact Click here to open the menu.

Interactive COVID-19 Simulation: The Effects of Physical Distancing on Transmission

Introduction

This interactive simulation lets you explore how different levels of physical distancing affect the transmission of COVID-19. Each month you choose the percentage of normal interactions people will have, ranging from 100% (business as usual) to 0% (no one interacts with anyone), then press the button to see what happens over the next 30 days. If you like, you can interpret your role as that of a policy-maker in February 2020 who must decide whether (and how much) to “lock down” society.

The Simulation

knitr::include_app(url = "https://chris31415926535.shinyapps.io/covid_seir/")

If the simulation isn’t working (which might happen if I hit my Shiiny usage limits), you can grab the code on GitHub here and run it locally to your heart’s content.

Take-Home Messages

I got three big things out of this:

How does it work?

It’s based on the epidemiological model developed by Anderson et al. (2020) and presented in this paper, which is used by the Public Health Agency of Canada in its official reports (PHAC 2021, 9). The authors have created covidseir, a wonderful R package that you can download and install from GitHub!

The model is a variant of the epidemiological SEIR model of how diseases spread. Please see the paper for details, but at a high level it tracks how people move through six states over time:

There are also six variables for people practicing physical distancing: \(S_d\), \(E_{1d}\), \(E_{2d}\), \(I_d\), \(Q_d\), and \(R_d\). People are assumed to be immune once they enter state \(R\).

The model describes how these groups change over time with differential equations. I won’t repeat them here (you’re welcome), but I will link to the paper one more time so you can see them yourselves on pages 6 and 7!

In brief, people start out \(S\)usceptible, then get \(E_1\)xposed, then after a while they are both \(E_2\)xposed and able to infect others, then they become visibly \(I\)nfected and symptomatic, then either go straight to \(R\)ecovery, or into \(Q\)uarantine and then into \(R\)ecovery.

At the same time, people can either start or stop physical distancing when they’re in any of these states; the model assumes that there is some flow back and forth from distancing and not-distancing, but that in general more people start distancing than stop.

Cautionary notes about this simulation!

For more robust COVID-19 simulations in R, check out covidseir

Anderson (2021) have made the wonderful covidseir package available on GitHub here. It’s a much more sophisticated implementation that is able to work with real data to make predictions. The only downside is that it’s not on CRAN, which is why I used a different package to solve the ODEs numerically in the Shiny app.

References

Anderson, Sean. 2021. “Seananderson/Covidseir.” https://github.com/seananderson/covidseir.

Anderson, Sean C., Andrew M. Edwards, Madi Yerlanov, Nicola Mulberry, Jessica E. Stockdale, Sarafa A. Iyaniwura, Rebeca C. Falcao, et al. 2020. “Estimating the Impact of COVID-19 Control Measures Using a Bayesian Model of Physical Distancing.” Preprint. Epidemiology. https://doi.org/10.1101/2020.04.17.20070086.

Kantamneni, Neeta. 2020. “The Impact of the COVID-19 Pandemic on Marginalized Populations in the United States: A Research Agenda.” Journal of Vocational Behavior 119 (May): 103439. https://doi.org/10.1016/j.jvb.2020.103439.

Soetaert, Karline, Thomas Petzoldt, R. Woodrow Setzer, Peter N. Brown, George D. Byrne, Ernst Hairer, Alan C. Hindmarsh, et al. 2020. “deSolve: Solvers for Initial Value Problems of Differential Equations (’ODE’, ’DAE’, ’DDE’).” https://CRAN.R-project.org/package=deSolve.

Tags: