Giter Site home page Giter Site logo

juliaepi / covid19survey Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreaskoher/covid19survey

0.0 0.0 0.0 2.82 MB

source code for "Monitoring Public Behaviour During a Pandemic Using Surveys: Proof-of-Concept Via Epidemic Modelling"

License: MIT License

Julia 100.00%

covid19survey's Introduction

Covid19Survey

This package implements the epidemiological model and data preprocessing steps of the publication "Monitoring Public behaviour During a Pandemic Using Surveys: Proof-of-Concept Via Epidemic Modelling" [1]. The epidemiological model is a variant of the popular semi-mechanistic approach of Flaxman et al. [2] and Unwin et. al. [3] as well as the related Epidemia package. The code is entirely written in the Julia language and we perform inference using the MCMC package Turing.jl.

prerequisites

The implementation has been tested on Julia 1.6. After starting Julia, please change to the project directory, enter the pgk> environment by pressing ], activate the project and instantiate to download the correct dependencies:

julia> cd("path/to/Covid19Survey")
pkg> activate .
pkg> instantiate

data pre-processing

This package includes the complete pre-processing and analysis pipeline used in the paper Monitoring Public behaviour During a Pandemic Using Surveys: Proof-of-Concept Via Epidemic Modelling [1]. If you are not interested in the preprocessing steps and want to perform inference with the same parameters as in the paper, you can just skip this section.

The data folder contains publicly available mobility data from Google, Apple and Danish telco providers. It also contains epidemiological data from the Statens Serum Institute and raw responses to the HOPE survey on public behaviour and perception of the Covid19 pandemic in Denmark from 01-08-2020 to 01-03-2021.

You can perform the pre-processing steps on the raw moblity data, epidemiological data and behavioural survey data by executing the julia files found in scripts/mobility, scripts/epidata/, and scripts/survey, respectively. We store the pre-processed data as CSV files in the corresponding folders within data/. The script scripts/data_with_predictors.jl merges mobility, epidemiological and survey data into a final data frame with additional meta-information for the inference model. Similarly, the script scripts/data_without_predictors.jl produces a data frame that includes only epidemiological and meta data. Again, we store the final output in the corresponding data/ folder.

Inference

We can perform inference conveniently from the terminal by executing either scripts/inference_with_predictors.jl or scripts/inference_without_predictors.jl:

> cd path/to/HOPESurvey/scripts
> julia --threads 5 inference_with_predictors.jl

In this case, we start the script with five threads available for parallelization. Both scripts take the following additional parameter:

--samples,    -s      number of samples after warm-up (default: 1000)
--chains,     -c      number of chains sampled with multi-threading (default 4)
--warmup,     -w      number of samples to use for warmup/adaptation (default 1000)
--foldername, -f      folder name within HOPESurvey/scripts/ to store results (default \today)
--thinning,   -t      thinning (default 1)
--tree,       -e      maximum tree depth (default 5)
--target,     -r      target acceptance rate (default 0.99)

inference with predictors

We first discuss how to reproduce Fig. 2 and Fig. 3 in the publication using inference_with_predictors.jl. The script takes an additional parameter:

--predictors, -p    list of predictors from data/data_with_predictors.csv separated by comma (default: total-above18,google,apple,telco)

The predictors correspond to columns in the column names in the data file scripts/data_with_predictors.jl (see pre-processing). As an example, we reproduce the data underlying Fig. 2, i.e., the comparison between self-reported survey data (more precisely: fraction of individuals that report above 18 contacts in total, here: total-above18), google mobility data (google), apple mobility data (apple) and data provided by danish telecommunication companies (telco):

> cd path/to/HOPESurvey/scripts
> julia --threads 5 inference_with_predictors.jl -s 1000 -c 5 -w 1000 -e 8 -p total-above18,google,apple,telco

Similarly, we run the comparison for context depending risk-taking behaviour with a threshold at the 80th percentile (Fig.3). The threshold translates into the following choice of predictors:

> cd path/to/HOPESurvey/scripts
> julia --threads 5 inference_with_predictors.jl -s 1000 -c 5 -w 1000 -e 8 -p strangers-above5,family-above3,friends-above4,colleagues-above4

inference without predictors

In Fig. 1 but also in multiple figures in the appendix, we provide a visual comparison between predictors and the inferred reproduction number. We obtain the latter from a daily random walk model of the effective reproduction number without predictors. Executing the following script does the job:

> cd path/to/HOPESurvey/scripts
> julia --threads 5 inference_without_predictors.jl -s 1000 -c 5 -w 1000 -e 8

[1] A. Koher, F. Jørgensen, M. B. Petersen, S. Lehmann, Monitoring Public behaviour During a Pandemic Using Surveys: Proof-of-Concept Via Epidemic Modelling

[2] Flaxman S., Mishra S., Gandy A., Bhatt S. et al. Estimating the effects of non-pharmaceutical interventions on COVID-19 in Europe. Nature, 584(7820), 257-261.

[3] Unwin HJT, Mishra S, Bradley VC, Gandy A, et al., State-level tracking of COVID-19 in the United States. Nat Commun. 2020 Dec 3;11(1):6189

covid19survey's People

Contributors

andreasko avatar andreaskoher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.