Welcome to COVIDNPIs’ documentation!

This is the documentation for the COVIDNPIs project, Bayesian modelling the impact of non-pharmaceutical interventions (NPIs) on the rate of transmission of COVID-19 in 41 countries around the world. See the paper The effectiveness of eight nonpharmaceutical interventions against COVID-19 in 41 countries by Brauner et. al. for details of the model.

COVIDNPIs provides a Data Preprocessor for converting time-series case and death data along with NPI activation indicators to PreprocessedData objects, ready to use for inference in any of several NPI models. In addition, the Epidemiological Parameters module provides utilities for computing delay distributions, which can then be provided as initialisation parameters to the NPI models.

The Examples walk through using the PreprocessedData object, initialising and running a model with custom delay parameters. Many pre-defined Experiments are can also be run as scripts.

Installation

Install dependencies, then activate the virtual environment:

poetry install
poetry shell

Minimal Example

The following steps are sufficient to run the default model with the dataset notebooks/double-entry-data/double_entry_final.csv and save the NPI reduction trace to CMReduction_trace.txt which can be loaded with numpy.loadtext

from epimodel.preprocessing.data_preprocessor import preprocess_data
from epimodel.pymc3_models.models import DefaultModel
from epimodel.pymc3_models.epi_params import EpidemiologicalParameters, bootstrapped_negbinom_values
import pymc3 as pm

data = preprocess_data('../notebooks/double-entry-data/double_entry_final.csv')

with DefaultModel(data) as model:
    model.build_model()

with model.model:
    model.trace = pm.sample(2000, tune=1000, cores=4, chains=4, max_treedepth=12)

numpy.savetext('CMReduction_trace.txt',model.trace['CMReduction'])

Indices and tables