Skip to content

Simple Monte Carlo sim of Iceland covid-19 case data

Notifications You must be signed in to change notification settings

jsbcannell/C19sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

C19sim

Simple Monte Carlo sim of Iceland covid-19 case data, using data from: https://www.covid.is/data

Compile with:

g++ -std=c++14 -fno-threadsafe-statics -o C19sim c19sim.cpp -I .

The simulation takes in 4 command line arguments:

0: The number of observed deaths to date (2 as of 3/29/2020)

1: The IFR hypothesis (typical values in the range of 0.001 to 0.01)

2: The ratio N/C: #infected / #cases: (the underascertainment ratio), reasonable values in the range of 3.0 to 4.0

3: The 'shape' of the undetected infections, an integer in (0,1,2), explained below

Example:

./C19sim 2 0.001 3.0 1

The simulation loads the iceland_cases.csv file to get the raw data on the number of new cases each day. From that it then adds in the inferred unobserved infections to get total new infection counts per day. The distribution of the extra unobserved infections is generated by one of the 3 distributions, controlled by 'shape':

0: A uniform distribution (unrealistic)

1: The sigmoid function y = e^(0.3x-1) / (e^(0.3x-1)+1), which is fit to the idea that infection count growth had saturated by the time deCODE genetics started testing random volunteers

2: The extra unobserved infections follow the same shape as the observed infections

The sim then proceeds day by day. For each infected patient, it rolls a random number to deterimine if they die, based on the IFR. If they do die, it computes their simulated day of death by sampling from a lognormal_distribution(2.8,0.45) which has a mean of ~18 and a median ~13, which I picked to fit these papers:

https://wwwnc.cdc.gov/eid/article/26/6/20-0320_article (median)

http://www.cidrap.umn.edu/news-perspective/2020/03/old-age-sepsis-tied-poor-covid-19-outcomes-death (mean)

If the simulated day of death is less than the max day (today), then the death is added to the total sim death counter. If the death is in the future (unobserved), then it is ignored. The end result of this is a model prediction on the total cumulative number of deaths up to now.

We then run this loop many times and record the fraction of runs where the simulated death count equals the observed death count. This ratio is the estimate of P(E|H).

Running the sim with different values of IFR then can give you odds ratios and allow for estimating a posterior distribution.

About

Simple Monte Carlo sim of Iceland covid-19 case data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages