This repository is a fork of the Impieral covid19model and applies the methodology used in report 20 introduced in release 4 of the Imperial repo (using google mobility data to predict Rt/infections/deaths) to the UK. All data is stored in the Italy folder - other folders are essentially unused in the repo for the moment.
Code for modelling estimated deaths and cases for COVID19 from Report 13 published by MRC Centre for Global Infectious Disease Analysis, Imperial College London: Estimating the number of infections and the impact of nonpharmaceutical interventions on COVID-19 in 11 European countries
If you are looking for the individual based model used in Report 9, please look here
This is the release related to report 23, where we use mobility data to estimate situation in all states of the USA. All other code is still the same.
To run this code you can directly run the base-usa.r file or from command line after seting the current directory as the repository directory run the following command Rscript base-usa.r
The code shold be run in full mode to obtain any results. Not running full model to estimate anything is not recommended and discouraged. Only full run should be used to get results.
The instructions for European, Italy and Brazil code are same as earlier (Look at version 3, version 4 and version 5). This release is specific to USA report
This is the release related to report 21, where we use mobility data to estimate situation in Brazil. All other code is still the same.
To run this code you can directly run the base-Brazil.r file or from command line after seting the current directory as the repository directory run the following command Rscript base-Brazil.r
The code shold be run in full mode to obtain any results. Not running full model to estimate anything is not recommended and discouraged. Only full run should be used to get results.
The instructions for European and Italy code are same as earlier (Look at version 3 and version 4). This release is specific to Brazil report
This is the release related to report 20, where we use mobility data to estimate situation in Italy. All other code is still the same.
To run this code you can directly source the base-italy.r file in rstudio inside the project or from command line after setting the current directory as the repository directory run the following command Rscript base-italy.r base-italy google interventions '~ -1 + residential + transit + averageMobility' '~ -1 + residential + transit + averageMobility'
The code for scenarios runs only in full mode not in short run or debug mode. Not running full model to estimate anything is not recommended and discouraged. Only full run should be used to get results.
The instructions for European code are below. This release is specific to Italy report
In this update, we first extended our model from version 2 to have 'partial-pooling' for lockdown across all countries. This means now we have a global effect of lockdown along with each country having its own different lockdown effect. We also made our code modular, stan code faster (with help from the community) and now we create CSV outputs too for usage.
You can directly get csv files here and new model description here
In this update we extend our original model to include (a) population saturation effects, (b) prior uncertainty on the infection fatality ratio and (c) a more balanced prior on intervention effects. We also (d) included another 3 countries (Greece, the Netherlands and Portugal). The updated technical detail is available here.
You can directly look at our results here
This repository has code for replication purposes. The bleeding edge code and advancements are done in a private repository. Ask report authors for any collaborations.
We welcome all potential collaborators and contributors from the wider community. Please see contributing for more details.
An environment.yml
file is provided and can be used to build a virtual
environment containing all model dependencies. Create the environment using:
conda env create -f environment.yml
Then activate the environment for use:
conda activate covid19model
A Docker image providing all model dependencies is available. See docker/README.md for details of running the model with Docker.
If you wish to install packages into your native R environment or with a system
package manager please see environment.yml
for a full list of dependencies.
There are two ways to run our code:-
- Open the rstudio project covid19model.Rproj file in rstudio and run/source base.r file
- To run from commandline please enter the cloned directory and type
Rscript base.r base
in terminal
Please note to not make you wait for long we have by default set run sampling to a short period. For proper estimates please run it in FULL mode either by setting the flag --full
or the environment variable FULL=TRUE
. This will run sampling for 4000 iterations with 2000 warmups and 4 chains. The run time for 14 countries using new faster code is around 50 mins/1hr for the version 3 code.
Three different run modes are supported:
- DEBUG which can either be enabled by setting the flag
--debug
when running the base.r file as such:Rscript base.r base --debug
or by setting the environment variableDEBUG
toTRUE
.
- DEFAULT which will run if neither full nor debug are set. Please note that for proper estimates FULL should always be set.
- FULL which must always be used if you want to obtain reliable results and can be enabled by setting the flag
--full
on the command line:Rscript base.r base --full
or by setting the environment variableFULL
toTRUE
.
- The results are stored in two folders results and figures.
- Results have the stored stan fits and data used for plotting
- Figures have the images with daily cases, daily death and Rt for all countries.