• Stars
    star
    944
  • Rank 48,415 (Top 1.0 %)
  • Language Stan
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code for modelling estimated deaths and cases for COVID19.

covid19model DOI

Code for modelling estimated deaths and infections for COVID-19 from "Estimating the effects of non-pharmaceutical interventions on COVID-19 in Europe", Flaxman, Mishra, Gandy et al, Nature, 2020, the published version of our original Report 13.

If you are looking for the individual based model used in Imperial's Report 9, Ferguson, Laydon, Nedjati-Gilani et al, please look here.

Version 12 Release DOI

This is the release related to our Tiers paper, where we use latent factor model to estimate the effectiveness of tiers systems in England. Peer reviewed version to be out soon. All other code is still the same for previous releases.

To reproduce results of the paper either from Rstudio source("tiers/spline_LFA.R") or from the command line Rscript tiers/spline_LFA.R.

The instructions for reproducing European report , Italy report , Brazil report , USA report , Nature, IFR, USA age specific report, Nature Communincations, and Science paper are the same as earlier (Look at version 3, version 4, version 5, version 6, version 7, version 8, version 9, version 10 and version 11). This release is specific to Tiers paper.

This release has been checked on macOS Catalina version 10.15.6/7 and Ubuntu version 18.04.2.

The authors of version 12 Release are Daniel J Laydon, Swapnil Mishra, and Samir Bhatt

Version 11 Release DOI

This is the release related to our Science paper, where we use age-specific mobility data to estimate the epidemic in the USA by accounting for age-specific heterogeneity. All other code is still the same for previous releases.

To run this code you need to follow the steps listed in the age-specific model here.

The code should be run in full mode to obtain credible results. Not running a full run to estimate anything is not recommended and discouraged. Only a full run should be used to get results.

The instructions for reproducing European report , Italy report , Brazil report , USA report , Nature, IFR, USA age specific report and Nature Communincations are the same as earlier (Look at version 3, version 4, version 5, version 6, version 7, version 8, version 9 and version 10). This release is specific to Science paper.

This release has been checked on macOS Catalina version 10.15.6/7 and Ubuntu version 18.04.2.

The authors of version 11 Release are Melodie Monod, Alexandra Blenkinsop, Xiaoyue Xi, H Juliette Unwin, Swapnil Mishra, Oliver Ratmann"

Version 10 Release DOI

This is the release related to Unwin, H.J.T., Mishra, S., Bradley, V.C. et al. State-level tracking of COVID-19 in the United States. Nat Commun 11, 6189 (2020). https://doi.org/10.1038/s41467-020-19652-6, 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-cases.r

The code should be run in full mode to obtain credible results. Not running a full run to estimate anything is not recommended and discouraged. Only a full run should be used to get results.

The instructions for European, Italy, Brazil, USA, Nature, IFR, USA age-specific code are the same as earlier (Look at version 3, version 4, version 5, version 6, version 7, version 8, and version 9). This release is specific to [ usa-paper (soon to be out) and medRxiv paper.

This release has been checked on macOS Catalina version 10.15.6/7 and Ubuntu version 18.04.2.

Version 9 Release DOI

This is the release related to report 32 and medRxiv paper, where we use age-specific mobility data to estimate the epidemic in the USA by accounting for age-specific heterogeneity. All other code is still the same for previous releases.

To run this code you need to follow the steps listed in the age-specific model here.

The code should be run in full mode to obtain credible results. Not running a full run to estimate anything is not recommended and discouraged. Only a full run should be used to get results.

The instructions for European, Italy, Brazil, USA, Nature, and IFR code are the same as earlier (Look at version 3, version 4, version 5, version 6, version 7, and version 8). This release is specific to report 32.

This release has been checked on macOS Catalina version 10.15.6/7 and Ubuntu version 18.04.2.

Version 8 Release DOI

The code for running models remains unchanged in the release. We provide scripts to calculate ifr for European countries and USA states. We hope the release of ifr computation code will enable the researchers to adapt the ifr calculations as per their requirements. The two files to run are compute-ifr-europe.r and compute-ifr-usa.r.

The code for ifr calculation for a new country will need changes if you have different age-specific bands. The code provided is not a universal code that will work for each country, the intention is to help researchers to modify the code easily for their setup.

The code for ifr needs an additional package named socialmixr, which is not specified in environment file as it doesn't exist with conda. You will need to download it via CRAN.

Version 7 Release DOI

This code is the exact code that was used in Flaxman, Mishra, Gandy et al. "Estimating the effects of non-pharmaceutical interventions on COVID-19 in Europe," Nature, 2020. https://www.nature.com/articles/s41586-020-2405-7

To run the code from the main folder in Rstudio source("base-nature.r") or from the command line Rscript base-nature.r.

The code should be run in full mode to obtain results---debug mode is only to check that your environment has the required libraries; results will not be reliable as the MCMC chains will not have converged.

The repository with posterior draws of the model in Flaxman, Mishra, Gandy et al. "Estimating the effects of non-pharmaceutical interventions on COVID-19 in Europe," Nature, 2020. https://www.nature.com/articles/s41586-020-2405-7 is here.

This code doesn't supersede our earlier model, it is here for everyone to have direct access to code used in Flaxman, Mishra, Gandy et al. "Estimating the effects of non-pharmaceutical interventions on COVID-19 in Europe," Nature, 2020.https://www.nature.com/articles/s41586-020-2405-7.

The instructions for European, Italy, Brazil, and USA code are the same as earlier (Look at version 3, version 4, version 5, version 6).

Version 6 Release

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 should 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 release has been checked on macOS Catalina version 10.15.6 and Ubuntu version 18.04.2. A full run takes about 20 hours using 4 cores.

Version 5 Release

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

Version 4 Release

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

Version 3 Release

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

Notice

⚠️ Python code is right now not updated and won't work. Python code is good for only version 1 model and data.

⚠️ base_general.r and base_general.stan, base_general_speed.stan and base_general_speed2.stan are now valid models for only version2

⚠️ This code is released with no support. We try our best to look at issues and pull request but can't help people with setup most of the time. We have docker images and conda environment file to make it easy for you to get started with the setup, any other approach assumes user can handle their computing environments approriately.

⚠️ This model is in active development and so parameter name and behaviours, and output file formats will change without notice.

⚠️ As with any mathematical model, it is easy to misconfigure inputs and therefore get meaningless outputs. The development team only endorses outputs it has itself generated.

Version 2 Release

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.

Contributing

We welcome all potential collaborators and contributors from the wider community. Please see contributing for more details.

Installing dependencies

Using Conda

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

This does not include the packages required for plotting maps. The following packages are required:

library(ggplot2)
library(ggstance)
library(ggrepel)
library(cowplot)
library(geofacet)
library(broom)
library(maptools)
library(rgeos)
library(rgdal)
library(colorspace)
library(sf)
library(scales)
library(bayesplot)
library(matrixStats)
library(boot)
library(lubridate)

Using Docker

A Docker image providing all model dependencies is available. See docker/README.md for details of running the model with Docker.

Other

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.

How to run the code

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.

Run mode settings

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 variable DEBUG to TRUE.
  • 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 variable FULL to TRUE.

Results

  • 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.

More Repositories

1

formalising-mathematics

Lean 3 material for Kevin Buzzard's 2021 TCC courrse on formalising mathematics. Lean 4 version available here: https://github.com/ImperialCollegeLondon/formalising-mathematics-2024
Lean
301
star
2

natural_number_game

Building the natural numbers in Lean 3. The original natural number game, now frozen. See README for Lean 4 information.
Lean
288
star
3

sap-voicebox

Speech Processing Toolbox for MATLAB
MATLAB
235
star
4

FLT

Ongoing Lean formalisation of the proof of Fermat's Last Theorem
Lean
166
star
5

M40001_lean

Lean 3 material related to Imperial College's "Introduction to University Mathematics" course
Lean
156
star
6

sharpy

Simulation of High Aspect Ratio aeroplanes and wind turbines in Python: a nonlinear aeroelastic code
Python
121
star
7

formalising-mathematics-2022

Lean 3 material for Kevin Buzzard's Jan-Mar 2022 course on formalising mathematics. Lean 4 version available here: https://github.com/ImperialCollegeLondon/formalising-mathematics-2024
Lean
118
star
8

django-drf-filepond

A Django app providing a server implemention for the Filepond file upload library
Python
103
star
9

formalising-mathematics-2024

Formalising Mathematics; a course for undergraduate mathematicians. Ran between January and March 2024.
Lean
100
star
10

real-number-game

A gamification of the theorems in MATH40002 Analysis 1
Lean
77
star
11

ICLOCS

Imperial College London Optimal Control Software (ICLOCS)
MATLAB
71
star
12

M4P33

M4 algebraic geometry course in Lean
Lean
58
star
13

group-theory-game

Building group theory from scratch in Lean
Lean
57
star
14

pnextract

Pore network extraction from micro-CT images of porous media
C++
55
star
15

formalising-mathematics-2023

repository for material for Jan-Mar 2023 course on formalising mathematics
Lean
49
star
16

epidemia

epidemia package
R
47
star
17

pnflow

Classical network (extraction and) flow simulation
C
41
star
18

EventEMin

Event-based vision motion estimation
C++
40
star
19

Visual2

F# re-implementation of VisUAL educational ARM assembler and simulator.
F#
37
star
20

RCDS-comm-line

https://github.com/kmichali/GS_comm_line
Jupyter Notebook
35
star
21

complex-number-game

The Complex Number Game. Make the complex numbers in Lean.
Lean
34
star
22

RCDS-profiling-and-optimisation-in-python

Jupyter Notebook
31
star
23

RCDS-object-oriented-python

Jupyter Notebook
27
star
24

RCDS-intro-to-containers

24
star
25

xena-UROP-2018

A place to put our 2018 Xena project UROP thoughts and programs.
Lean
23
star
26

porefoam

Direct pore-scale simulation of single- and two-phase flow through confined media (alpha-release / experimental)
C
23
star
27

csml-reading-group

Computational statistics and machine learning reading group at Imperial College London (2019-2020)
SCSS
23
star
28

Example-Lean-Projects

Some examples of Lean projects, for undergraduate mathematicians.
Lean
22
star
29

EpiCollectplus

The next generation of EpiCollect, multiple forms, more fields and more control. We recommend using Apache 2.2 or later, PHP 5.3 or later and MySQL 5.5 or later.
PHP
22
star
30

pyrealm

Development of the pyrealm package, providing an integrated toolbox for modelling plant productivity, growth and demography using Python.
Python
21
star
31

RCDS-machine-learning-with-python

Getting started with scikit-learn for machine learning
Jupyter Notebook
21
star
32

spear-tools

SPEAR Challenge scripts and tools.
Python
21
star
33

porescale

Shell
21
star
34

UVLM

Unsteady Vortex Lattice Method for Aeroelasticity in C++
C++
21
star
35

RCDS-intro-to-machine-learning

Imperial College London / Graduate School / Data Science / Introduction to Machine Learning
21
star
36

poreFoam-singlePhase

Direct single-phase flow simulation and pre/post-processing codes
C++
18
star
37

poetry_template

Poetry-based Python application template with automated testing, CI and docs
Python
18
star
38

imperial_latex_templates

Official LaTeX templates employing the Imperial College London brand.
TeX
17
star
39

RCDS-data-processing-with-python

Imperial College London / Graduate School / Data Science / Data Processing with Python Pandas
Jupyter Notebook
17
star
40

RCDS-introduction-to-fortran

An Introductory Fortran course delivered by the Imperial College London Graduate School.
Fortran
15
star
41

multifluids_icferst

Fortran
15
star
42

GUIs-for-RS

Workshop on Graphical User Interfaces for Research Software
15
star
43

ComputerVision2018-19

Computer Vision 2018-19
Jupyter Notebook
14
star
44

M1P1-lean

Material from M1P1, formalised in Lean
Lean
14
star
45

RCDS-numerical-computing-in-python-with-numpy-and-scipy

Jupyter Notebook
14
star
46

R2T2

Research References Tracking Tool
Python
14
star
47

WInc3D

Wind Farm Simulator
Fortran
14
star
48

m1fexplained_lean3

A Lean formalisation of parts of Martin Liebeck's "A concise introduction to pure mathematics"
Lean
13
star
49

wsi

WSIMOD is a software for simulating water quality and quantity
Python
13
star
50

sap-sh-doa-estimation

Direction of arrival estimation algorithms in the spherical harmonics domain
MATLAB
13
star
51

fractalgenetics

Analysis of the genomic architecture and functional role of myocardial trabeculae
MATLAB
13
star
52

RCDS-writing-theses-in-latex

TeX
12
star
53

RCDS-introduction-to-latex

TeX
12
star
54

lean-maths-examples

Some theorems presented to first and second year mathematics undergraduates, First and second year undergraduate level mathematics
Lean
12
star
55

Multiview-Motion-Estimation-for-3D-cardiac-motion-tracking

Python
12
star
56

cardiovascular_ageing

HTML
12
star
57

ReCoDe-Euler-Maruyama

ReCoDe project to showcase an implementation of the Euler-Maruyama numerical method to solve Stochastic Differential Equations
Python
11
star
58

RCDS-sampling-and-hypothesis-testing

Imperial College London / Graduate School / Data Science / Introduction to Sampling & Hypothesis Testing
HTML
11
star
59

RCDS-plotting-in-python-with-matplotlib

Jupyter Notebook
10
star
60

pytest_template_application

Python application template with automated QA and Docker image publishing
Python
10
star
61

M1F-explained

A computer formalisation of parts of Martin Liebeck's book "a concise introduction to pure mathematics"
Lean
10
star
62

diastolic_genetics

Analysis of the genetic and environmental predictors of diastolic heart function
R
9
star
63

grad_school_software_engineering_course

Essential Software Engineering for Researchers
HTML
9
star
64

DirectSearch.jl

Direct search methods for derivative-free optimization
Julia
9
star
65

BART-Int

Bayesian Probabilistic Numerical Integration with Tree-Based Models (using Bayesian Additive Regression Trees)
R
9
star
66

python-guis

Python
9
star
67

virtual_ecosystem

This repository is the home for the codebase for the Virtual Ecosystem project.
Python
9
star
68

US-covid19-agespecific-mortality-data

Extract COVID-19 age-specific mortality counts in U.S states and metropolitan areas
HTML
9
star
69

RCDS-further-hypothesis-testing

Imperial College London / Graduate School / Data Science / Further Hypothesis Testing
HTML
9
star
70

diophantine

Solving Diophantine equations in Lean
Lean
8
star
71

RCDS-data-exploration

Imperial College London / Graduate School / Data Science / Data Exploration & Visualisation
8
star
72

RCDS-intro-to-r

Imperial College London / Graduate School / Data Science / Introduction to R
HTML
8
star
73

RCDS-managing-and-running-python-effectively

Python
8
star
74

fragment-cloud

Semi-analytic atmospheric entry modelling for meteoroids
C++
8
star
75

grad_school_git_course

Using Git to Code, Collaborate and Share
HTML
8
star
76

ReCoDE_Diffusion_Code

Repository for the ReCoDE project which aims to solve the Neutron Diffusion Equation
Fortran
8
star
77

guikit

Template to write GUIs based on wxPython that takes care of a large part of the boilerplate code to get started.
Python
8
star
78

3DKSL

3D Motion Segmentation of Articulated Rigid Bodies based on RGB-D data
C++
7
star
79

pure-maths-yamls

Descriptions of the main theorems and definitions in all the pure maths courses at Imperial
7
star
80

openFrame

This repository is for the openFrame microscope and supporting projects
7
star
81

tcc-lean-alg-geom-2022

Experiments in algebraic geometry as part of the EPSRC Taught Course Centre course on formalising number theory and geometry
Lean
7
star
82

Computer_Vision_2022

Jupyter Notebook
7
star
83

group-theory-experiments

Lean 4 experiments in undergraduate group theory
Lean
7
star
84

ReCoDE_IDMS

HTML
7
star
85

acoustics-db

Python
7
star
86

al_cfd_benchmark

Active learning based regression for CFD cases
C++
7
star
87

rcs-pacemakers

Example of GPU-accelerated machine learning on the RCS compute cluster using Jupyter and conda
Jupyter Notebook
7
star
88

Computer_Vision_2020

CO315: Computer Vision, Spring Term, 2019 - 2020
Jupyter Notebook
6
star
89

RCDS-data-processing-with-r

Imperial College London / Graduate School / Data Science / Data Processing with R
HTML
6
star
90

django-passwordless-login

Login to your Django app with a link sent by email.
Python
6
star
91

covid19cumdeaths

R
6
star
92

Zambelli2019_RAS_multimodal_VAE

Code and dataset for the RAS accepted paper "Multimodal representation models for prediction and control from partial information"
Python
6
star
93

RCDS-basic-statistics

Imperial College London / Graduate School / Data Science / Basic Statistics
R
6
star
94

Computer_Vision_2023

Courseworks for Computer Vision 2023 (Spring Term)
Jupyter Notebook
6
star
95

rcs_flask_aad_login

Python package to allow Flask web applications to single sign-on through IC's Azure Active Directory
Python
6
star
96

AI4PDEs

PDE solvers expressed as neural networks
Python
6
star
97

Y2CL_Worksheet_Template

2nd Year Physics Computing Laboratory Worksheet
Python
6
star
98

ReCoDE_rnaseq_pipeline

A parallelised pipeline for the analysis of RNA sequencing data. This repository is part of Imperial College London's ReCoDE project, which aims to support teaching and learning in research computing and data science.
Shell
6
star
99

webBO

HTML
5
star
100

condensed-sets

Condensed mathematics in Lean
Lean
5
star