Skip to content

Bayesian SEIR model to estimate the effects of social-distancing on COVID-19

Notifications You must be signed in to change notification settings


Repository files navigation


Bayesian SEIR Modelling for Multivariate COVID-19 Case Data

R-CMD-check Lifecycle: experimental


covidseir fits a Bayesian SEIR (Susceptible, Exposed, Infectious, Recovered) model to daily COVID-19 case data. The package focuses on estimating the fraction of the usual contact rate for individuals participating in physical distancing (social distancing). The model is coded in Stan. The model can accommodate multiple types of case data at once (e.g., reported cases, hospitalizations, ICU admissions) and accounts for delays between symptom onset and case appearance.

The model is a continuation of the model described in the papers:

Anderson, S. C., Edwards, A. M., Yerlanov, M., Mulberry, N., Stockdale, J., Iyaniwura, S. A., Falcao, R. C., Otterstatter, M. C., Irvine, M. A., Janjua, N. Z., Coombs, D., & Colijn, C. (2020). Quantifying the impact of COVID-19 control measures using a Bayesian model of physical distancing. PLoS Computational Biology. 16(12): e1008274.

Anderson, S. C., Mulberry, N., Edwards, A. M., Stockdale, J. E., Iyaniwura, S. A., Falcao, R. C., Otterstatter, M. C., Janjua, N. Z., Coombs, D., and Colijn, C. (2021). How much leeway is there to relax COVID-19 control measures? Epidemics. 100453.

Illustration for logo by Alissa Eckert, MSMI; Dan Higgins, MAMS.

This package is a work in progress: arguments and output format may still change and not all functionality has been tested.


Before installation, you will need a C++ compiler installed to compile the Stan model. Follow the relevant instructions on configuring a C++ toolchain for your operating system on the rstan wiki.

The following must return TRUE before continuing:

# install.packages("pkgbuild")
pkgbuild::has_build_tools(debug = TRUE)

Then, install the covidseir package with:

# install.packages("remotes")

See the examples in ?fit_seir and ?project_seir and the vignette.

To install the package with the vignette:

remotes::install_github("seananderson/covidseir", build_vignettes = TRUE)

and run:



Bayesian SEIR model to estimate the effects of social-distancing on COVID-19






Contributors 4