https://statmodeling.stat.columbia.edu/2020/08/17/epidemia-an-r-package-for-bayesian-epidemiological-modelling/

epidemia: An R package for Bayesian epidemiological modeling

Posted by Andrew on 17 August 2020, 6:54 pm

Jamie Scott writes:

I am a PhD candidate at Imperial College, and have been working with colleagues here to write an R package for fitting Bayesian epidemiological models using Stan.

We thought this might interest readers of your blog, as it is based on work previously featured there.

The package is similar in spirit to rstanarm – Stan code is precompiled, and R’s formula interface is used to specify the models.

Here’s their description of the package:

epidemia is an R package for fitting Bayesian epidemiological models similar to that introduced in Flaxman, S., Mishra, S., Gandy, A. et al. Nature 2020, and those used in subsequent Imperial Covid-19 reports herehere, and here.

The package is inspired by rstanarm and uses Stan as the backend for fitting models.

Reproduction numbers and latent infections can be inferred from count data – for example daily recorded case or death counts. A renewal equation is used to model latent infections within a population. This is motivated by the Bellman-Harris process which provides interpretable epidemiological dynamics.

epidemia is designed to be flexible and leverages R’s formula interface to express reproduction numbers in terms of covariates. Epidemics can be modelled in multiple populations (i.e. countries, states, age-cohorts) simultaneously with hierarchical models. Partial pooling and autocorrelation terms can be used to model reproduction numbers.

Observed data can also be flexibly modelled. As an example, if daily reported cases are used one might wish to model the infection ascertainment rate (IAR) to account for changes in testing capacity over time. This is possible within the package.

More information is available here.

Above are some example plots produced with epidemia.

Beyond the potential utility of this package for real-life problem solving, I’m encouraged by the general pattern of writing R packages that make use of Stan to fit particular classes of models.

Leave a comment