Skip to main content

Global estimation of unobserved COVID-19 infection

Project description

NIDDK SICR Model for estimating SARS-CoV-2 infection in a population

Code and data used for Chow et al, "Global prediction of unreported SARS-CoV2 infection from observed COVID-19 cases", to model the progression of the COVID-19 epidemic and estimate the unobserved SARS-CoV-2 infected population from reported cases, case recoveries, and case deaths globablly. Models are implemented in Stan and fit using PyStan.

PyPI version Build Status

The core model is a variation of the SIR model with a latent variable I for the number of unobserved infected which is distinguished from C the observed cases. This model follows:




Several variants of this model are discussed in the Supplemental Material of the preprint. The code required to fit these models to data is provided in the models directory. Data sources include The Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE) and The COVID Tracking Project.

Requirements to run code here:

  • python 3.5+
  • Install the Python package:
    • From pypi: pip install covid-sicr
    • Or from source:
      • git clone
      • cd covid-sicr
      • pip install -e . # This installs the covid-sicr package from source
    • Or place this directory in your PYTHONPATH and install the contents of requirements.txt.
  • pystan may not be easily pip installable on some systems, so consider conda:
    • conda install -c conda-forge pystan

Important scripts:

  • New data can be downloaded from data sources with scripts/

    • For all data sources: python scripts/
    • This will use Johns Hopkins and COVID Tracking by default.
    • Other options can be seen with the --help flag.
    • Data sources follow a functional pattern and are extensible.
  • Stan models can be run with Python file scripts/

    • Run a single region with:
      • python scripts/ MODEL_NAME --roi=REGION_NAME
      • e.g. python scripts/ SICRLMQ --roi=US_MI
    • Other optional arguments for specifying paths and some fitting parameters can be examined with python scripts/ --help.
    • A pickle file containing the resultant fit will be produced in your fits-path (see help).
    • A scripts/ file is provided for reference but much better performance will be obtained by running scripts/ on a cluster.
  • Analyze finished fits for all regions with scripts/

    • For all regions (with fits) with python scripts/ MODEL_NAME
    • e.g. python --nonlinearmodel
    • As above, help is available with the --help flag.
    • Jupyter notebooks containining all analyzed regions will be created in your --fits-path.
  • Tables summarizing fit parameters can be generated with scripts/

    • python scripts/
    • e.g. python scripts/ --model-names nonlinearmodel fulllinearmodel
    • As above, help is available with the --help flag.
    • .csv files of the resulting dataframes will be created in the --fit-path directory in the tables subdirectory.

Reproducbility of a particular version of the manuscript will require using a particular tag, e.g. "medrXiv-v1" (see tags and releases here). Using the most recent version of any other branch (including master) may lead to different results as our research is on-going.

This code is open source under the MIT License. Correspondence on modeling should be directed to carsonc at nih dot gov or vattikutis at mail dot nih dot gov. Correspondence on the python code should be directed to rgerkin at asu dot edu.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

covid_sicr-1.0.4.tar.gz (17.4 kB view hashes)

Uploaded Source

Built Distribution

covid_sicr-1.0.4-py3-none-any.whl (19.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page