Package: covid-sicr
NIDDK SICR Model for estimating SARS-CoV-2 infection in a populationCode 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.The core model is a variation of the SIR model with a latent variableIfor the number ofunobservedinfected which is distinguished fromCtheobservedcases.  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 themodelsdirectory. 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-sicrOr from source:git clone http://github.com/nih-niddk-mbs/covid-sicrcd covid-sicrpip install -e .  # This installs the covid-sicr package from sourceOr place this directory in yourPYTHONPATHand install the contents ofrequirements.txt.pystanmay not be easily pip installable on some systems, so consider conda:conda install -c conda-forge pystanImportant scripts:New data can be downloaded from data sources withscripts/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--helpflag.Data sources follow a functional pattern and are extensible.Stan models can be run with Python filescripts/run.py:Run a single region with:python scripts/run.py MODEL_NAME --roi=REGION_NAMEe.g.python scripts/run.py SICRLMQ --roi=US_MIOther optional arguments for specifying paths and some fitting parameters can be examined withpython scripts/run.py --help.A pickle file containing the resultant fit will be produced in yourfits-path(see help).Ascripts/run-many.pyfile is provided for reference but much better performance will be obtained by runningscripts/run.pyon a cluster.Analyze finished fits for all regions withscripts/visualize.py:For all regions (with fits) withpython scripts/visualize.py MODEL_NAMEe.g.python visualize-master.py --nonlinearmodelAs above, help is available with the--helpflag.Jupyter notebooks containining all analyzed regions will be created in your--fits-path.Tables summarizing fit parameters can be generated withscripts/make-tables.py:python scripts/make-tables.pye.g.python scripts/make-tables.py --model-names nonlinearmodel fulllinearmodelAs above, help is available with the--helpflag..csvfiles of the resulting dataframes will be created in the--fit-pathdirectory in thetablessubdirectory.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.