Flexibly specify and fit Bayesian statistical models for epidemics. epidemia leverages R’s formula interface to paramaterize the time-varying reproduction rate as a function of covariates. Multiple regions can be modeled simultaneously with multilevel models. The design of the package has been inspired by, and has borrowed from, rstanarm. epidemia uses rstan as the backend for fitting models.

Getting Started


After installing the software, the best way to get started is to read the articles.

  • Model Description introduces the class of models that can be fit in epidemia.
  • Model Implementation shows how these models are implemented; considering the three main modeling functions, and the fitting function epim().
  • Partial Pooling presents the user with a number of example of how to leverage partial pooling.
  • Priors details which prior families are available for different model parameters, including intercepts, auxiliary parameters and covariance matrices.
  • A Basic Example infers reproduction numbers in Baltimore during the 1918 Spanish Flu epidemic.
  • A Multilevel Example infers the effects of NPIs in European countries during the first wave of Covid-19.