Skip to main content

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:

formula

formula

formula

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 http://github.com/nih-niddk-mbs/covid-sicr
      • 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/get-data.py:

    • For all data sources: python scripts/get-data.py.
    • 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.py:

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

    • For all regions (with fits) with python scripts/visualize.py MODEL_NAME
    • e.g. python visualize-master.py --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/make-tables.py:

    • python scripts/make-tables.py
    • e.g. python scripts/make-tables.py --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.

Metadata

Release files for covid-sicr 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for covid-sicr 1.0.4
File Size Uploaded Provenance
covid_sicr-1.0.4.tar.gz 17.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for covid-sicr 1.0.4
File Interpreter ABI Platform
covid_sicr-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 37.3 kB

Release files / covid_sicr-1.0.4.tar.gz

Download URL covid_sicr-1.0.4.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
717fb58974b4525a33fa75b8c52c04678bad9c9685a765c74d72420c023b38ae
BLAKE2b-256 checksum
How to use checksums
48c7f262887ea0749ae49b69d8691e8259861944dcb89095cbd6d4e4ed01597f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.7.6

Release files / covid_sicr-1.0.4-py3-none-any.whl

Download URL covid_sicr-1.0.4-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a726994599cfcf163ba59c43c2aab72a7278c6bc4649e679eff995cf528be4c2
BLAKE2b-256 checksum
How to use checksums
dd4418ee439a5e700925a033b30a56ea3beb8b2c177a2b34096094d377609183
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.7.6

Security for covid-sicr 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page