Giter VIP home page Giter VIP logo

covid-bestfit's Introduction

This started out as a quick perl script to play with Covid numbers The perl script is left here for interest - but (for reasons of speed) its been migrated to c++17. (NB, much of the conversion was done simply by reusing the same code, so it's fairly hideous code to read!)

The simulation is current setup to play with the numbers from https://covid.ourworldindata.org/data/owid-covid-data.csv

The script also takes into account mobility data as supplied by Google COVID-19 Community Mobility Reports https://www.google.com/covid19/mobility/.

The core of the script algorithm runs accross each day using an adjusted gaussian distribution to model reported cases. Each case generates new cases at the R0 value, but distributed with a mean and variance accross the days.

These mean and variance numbers have a HUGE impact on the results.

NB the model has been tuned for the French data only now.

Hence the factors that are 'adjutable' are

  • Base R0 for virus,
  • Mobility multiply,
    • By how much to adjust the moblity data to effect R0.
  • Daily Imported cases,
    • (starts the epidemic)
  • Infectious day mean,
    • Day on which a patient is most infections
  • Infectious day variance,
  • Case reporting delay mean,
    • Day on which a case is most likely reported
  • Case reporting delay variance,
  • Social Distancing effect,
    • Effect on R0 of social distancing etc.
  • Social Distance Inforduction day
    • The mean day on which social distancing is introduced
  • Social Distancing Introduction day variance
  • Start day
  • Temp cutoff
    • Temperature factor below which people seem to propogate the virus more
  • Temp factor
  • UK VoC Introduction day
    • Day the second varient arrived
  • UK VoC base R0
  • Mobility factors for : retail_and_recreation grocery_and_pharmacy parks transit_stations workplaces residential

A modified simulated annealing approach is then used to find the best match using these variables.

The result shows a relatively close match to the actual data.

France:

To run the simulation first compile with your preffered compiler, e.g.

  > c++ -O3 -std=c++17 covid.c++ -o covid

The program can be run in a few ways: ``bash

curl https://www.gstatic.com/covid19/mobility/Global_Mobility_Report.csv -o Global_Mobility_Report.csv curl https://covid.ourworldindata.org/data/owid-covid-data.csv -o owid-covid-data.csv

./covid country [-c][-o file.csv][-n runs][-q] [factors]

To find the best fit, simply run and wait ( a long time ) selecting the country you wish. This will use the supplied data for that country in owid-covid-data.csv and Global_Mobility_Report.csv

```bash
  > ./covid france

To generate a csv file suitable for import into a spreadsheet for a specific set of numbers, run it thus:

  > ./covid france -o numbers-fr.csv 2.4207148 0.805779693 1.02442175 3.76362184 5 5 12.3217681 1.50674125 0.695714995 71.3405724 21.2957611 

To restart the annealing process you can add the '-c' flag, e.g.:

  > ./covid france -c 2.4207148 0.805779693 1.02442175 3.76362184 5 5 12.3217681 1.50674125 0.695714995 71.3405724 21.2957611

This can be helpful to start the process from a reasonabl position, given new data. It will also not only output the best guess, but also the 10 most promising alternatives.

To set the number of runs to try, use -n (default 50000)

If you hit ^C during a run, then the program will finish the current runs and output the current best result.

covid-bestfit's People

Contributors

markfoodyburton avatar

Watchers

James Cloos avatar  avatar  avatar

covid-bestfit's Issues

Metadata Update

Hello,
Your dataset was added to CoronaWhy (https://www.coronawhy.org/) Data Lake on Dataverse as a piece of common COVID-19 data framehttp://datasets.coronawhy.org/dataset.xhtml?persistentId=doi:10.5072/FK2/BFS06W
Would you be willing to help with the maintenance of your dataset in Dataverse, e.g. adding the relevant metadata and keeping the dataset up-to-date? That will help to make the dataset findable and accessible for the medical science community.

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.