We're funded by donations from regular folks like yourself. Every little bit is useful, and we're grateful. If this information helps save your life or those of your loved ones, please reward us with what you think's fair, at gofundme.com/f/scrier. Thanks so much!!

     by SCRIER.org 
 March 15, 2020
     "say" indicates a tweakable parameter...
--Assumes ppl who are "severely ill" will by definition die if not hospitalized.
 --Assumes people in hospitals are no longer infectious to community at large
 --People who get out of hospitals may be infectious for another week or so,
  but this population never got modeled, so we're ignoring that for this version
 --Dead people are not infectious
 --Mild people get better by themselves after say 21 days but are infectious
 --Servere hospital stays get better after say 7 days, then all live
 --Magically no one dies who is only Severe, but still makes it into a hospital.
 --Half of criticals tie up ventilator then rudely die after say 1 week
 --Half of critical ICU stay w/ventilator get better after say 6 weeks
 --None of the doctors die in the hospitals, who're managing Severes and ventilators
 --Well people check out of the hospital in the morning
 --Available beds and vents are counted at noon
 --They hand out available vents/beds in the afternoon, but ppl die in morning,
   it only takes a few hours to clean used vents and beds to hand out in afternoon
   to the next people, not a day or more to clean linens and used ventilators
 --Severe or critical people who don't get into a hospital/ICU 
   still take, say, a couple days to die.  
 --Severe or critical people who don't get into a hospital/ICU
   and are hanging around at home but not dead yet, are still infectious
 --Severe or critical people who get denied hospitalization go home to sulk
   then die in a few days, and never get back into line, because the line
   will almost certainly already be full; too sick; and they'll be passed over.
   Last in, First out, & only people who start feeling sick on THAT DAY win. 
-- Assumes people can only get infected once.  Ignores virus mutations.
-- Assumes no one pulls ventilator away from someone to give it to someone else.
-- Assumes doctors do not die off in the middle, and magically always enough
   to staff the hospital beds and the ventilators.
-- Assumes severely and critically infected people who get turned away
   at the hospital are still infectious at the same rate as others,
   until they die.  Real life says they're substantially more infectious.
-- Assumes children are magically immune.  And do not act as carriers.
-- Ignores transmission vector between parents-->children (confirmed)
   children -> children (unconfirmed), and children -> parents (unconfirmed)
   since children are all magically immune.  And not counted as part of N.
 In real life, children seem to get the virus but be Mild, mostly asymptomatic.
The main contribution is a rough simulation of hospital beds and ventilators
running out of supply, and the effects on the population.
Since even Goldman Sachs is estimating only 3M U.S. deaths, as of March 16th'20,
I'm drawing attention to what I believe to be vitally critical results.
My baseline, without severe isolation practices, shows roughly 25-50M deaths.
[as of March 15, without social isolation] 
Uses a discrete-time deterministic simulation, with clock tick of 1 day.
I divide sick people into three cohorts:
    Mild infections (including Moderate and Asymptomatic);
    Severe, requiring hospitalization for survival, but not ventilators;
    and Critical infections, requiring 6 wks of ventilators for survival.
People are assigned into a cohort the day they get infected,
but they don't know it yet.  (% params).
For, say, a day of incubation they're not infectious themselves (param). 
They continue unaware that they have it, but infectious,
say for a different average number of days for each cohort,
then attempt to check in to a hospital if they're Severe or Critical.
If there's room at the hospital, and a ventilator for the Criticals,
then they get a bed or an ICU station; if full, they get turned away.
Turned away patients go home to sulk and die, but say it takes a couple days,
and during that time they're still infectious.

    Model is currently a relatively simple aggregate model of the entire region,
    this was done in order to get something reasonably accurate up and running rapidly.
    Studies show that if the population is subdivided into geographic cohorts,
    it doesn't make hardly any difference from a single population:
    large centers still spread immediately,
    and smaller centers still are seeded and spread a few weeks later,
    in a fractal fashion.


 Number of days incubation period, between time a person gets infected
 and the time they start being infectious themselves. 

 Note since discrete time ticks in one-day intervals,
 START_INFECTIOUS_AFTER = 0 means starts being infectious the very next day,
 and START_INFECTIOUS_AFTER = 1 means they skip one day so day after tomorrow.
 So people who get infected in the morning cannot infect in the afternoon,
 it's not set up to run that way.

 Best estimates are people start getting infectious 2 days or more before they
 start developing mild symptoms, and they start developing symptoms at 3 days.

 This number is assumed to be the same, standard, for all cohorts.
"Punch-in Infectious" day.  This is the incubation latency lag.

 At what duration day from the 0'th day they got infected,
 do people STOP being infectious? (Punch-Out Infectious, assuming hospitals).
 If START_INFECTIOUS_AFTER is 0, this is the total # days they're infectious;
 otherwise, you have to subtract START_INFECTIOUS_AFTER to get the
 # total days they're infectious.    .. These are broken down by cohorts.
 For the Milds, this is the last day that they're still sick,
 but wandering around unawares (baseline: assumes no quarantines).
 For the Severes, this is the last day that they're still wandering out sick,
 until they check into the hospital the next day.  If any slots open.
 For the Criticals, this is also the last day that they're out still sick,
 until they check into a hospital & get a ventilator  the next day.
 Milds (including moderate infections) have no need for hospitals to survive.
 Hospitals are assumed to take severes and criticals OUT of infecting others.
 If Severes or Criticals attempt to check into a hospital but are denied,
 they are no longer Unaware, so they continue on the infectious bucket list.
 They never try to go back into the hospital; they simply end up dying.

 Best current number on this is "10-14 days", maybe 5-9 until notice sick?
 But when check into hospital?  Call it 10.

 Maybe very sick gets sick slightly faster than severe?
 set two out of three of these to 0 if you only want to check one infect route

 How long does a person tie up a hospital bed, on average,
 if they are Severely sick and likely to die, but NOT critical, needing vent?
 This number is absolutely critical in determining blockage,
 and I don't have any good data on it.
 W.A.G. estimate average of one week.
 Changing this can substantially change outcome, 50M -> 35M.

 If going to die, how long is ICU ventilator tied up?
 This number could be longer, as it ignores average attrition.
 But we'll assume best-case, so the vent is freed up rapidly for next person.
#define DAYS_TO_DIE_IN_ICU   7

 If going to live, how long is ICU ventilator tied up?
 this number's pretty solid.
#define DAYS_TO_LIVE_IN_ICU  6*7
 only two simple cases, either die after one week
 or live and get released from hospital after 6 weeks.
 Ignores stochastic cases where people die off between now and then;
 but data is supporting these two rough clusters.
 Assumes no one pulls ventilator away from someone to give it to someone else.
 Assumes doctors do not die off in the middle, and magically always enough
 to staff the hospital beds and the ventilators.

 Suppose you feel sick after a couple days, but get TURNED AWAY at hospital.
 How soon until you die? (100%) But are still infectious and running around...


 Note:  These people in real life actually infect others at a 
 substantially increased rate.  But no effort is taken to model
 the Beta on these infection rates separately in subcohorts.

 Per cent of cases severity.  These will get /100 in initialize()...
double percent_Mild     =  80.0;      Asymptomatic for a few days, mild case
double percent_Severe   =  15.0;      Severe case needing hospital; else death
double percent_Critical =   5.0;      Critical case needing ventilator, or die
 -----------------------100.0% of infected cases.

double percent_ICU_die  = 50.0;      Given using vent, chances of early death
some say this number is closer to 90%.
It doesn't matter, as the number of people who are lucky enough to get vents
 will be down in the noise, unless everyone self-isolates.

 Version 1 parameter, Actual / Official-known Cases multiplier.
 Version 1 used a simple Atimes multiplier to model this.
 Version 2 uses a better and more sophisticated lag in days,
 which works out to the same for the first half,
 but doesn't go off the charts wildly for the second half.
     Old approach:
     Fudge factor for how many actual cases there are out there,
     for each reported, official, known case.
     Even assuming ideal testing,
     there's good evidence that this lags a number of days behind the curve,
     so ideally this number would change and eventually saturate down to 1.0
     as the number of actual infections hits 100% penetration.
     However, this factor is only really used seriously here,
     to set up a reasonable initial estimate for the lagged actual counts,
     and it's also used in reporting to give a ballpark figure
     of how far behind the curve the authorities are as the days roll by.
     It does affect how rapidly the hospitals run out of beds.
     Since if y = x^t, then cy = cx^t, there's no really good way of knowing
     this until the hospitals start filling up.
     You can estimate it from (death counts/0.02) / (known infection counts)
     if you believe the death rate should be 2%, before hospitals swamp.
     This is the best SWAG, based on death rates in Seattle,
     and the fact that current test rates as of Wed Mar 18 
     are...substantially behind the curve.
 obsolete:  double Actual_to_official_factor_10 = 10.0;   Number of actual cases/official.
 There is some thought that it could make some difference
 if flirting with hairy edges around hospital saturation points,
 but my personal best guess is at this point that's moot.  Still, perhaps.

 This assumes an average of 8 days of mostly asymptomatic or low behavior
 before a patient actually gets tested positive and declared a case.
 It also assumes 0 days lag in testing->results,
 and no false negatives / false positives.
 Also assumes all infected cases having symptoms get tested, idealized.

Version 2:
 note that a 7-day lag still gives 10x bump at startup,
 but evens out to 1x at finish as the curves converge.
 Much better.

 Interestingly, the number of deaths calibrates the number of actuals.
 Too many deaths too fast gives actuals are too high.
 Too few deaths gives actuals are too low, or death rates are wrong.
 But number of actuals is determined vs. number of knowns, + timelag.
 So a timelag of about 4.5 seems about right, 4 is quite close but optimistic.

 924,107 Feb '20; ?? 1.3M after tent cities
 Although supposedly US has just under a million beds,
 some other people will get sick too...350,000 births/month to start with.
 MASH hospital cots could double or triple this.
#define BED_COUNT  1000000

                     includes 62K delux, 98K basic,
                     20K presumed hidden strategic stockpile,
                     and 20K gratuitous good luck.
                     It won't matter.
#define VENT_COUNT  200000

 SIZE OF U.S. POPULATION,  N does not count children, who are magically immune
 by current thinking.

 Note:  Governments are unfortunately lying by omission when they say
 "70%-80% of people will get infected" [so hey, 30%-20% won't!].
 What they neglected to tell you was that
 21.4% of US population is kids under 14, and
 32% of population is kids under 24.
 So pretty much all of U.S. adults, who do not shelter in place for months,
 are expected to become infected.  This fits with our baseline.
 Actually, some adults 30 or under will have enough immunity that they don't,
 and some teens, esp. obese or diabetic ones (the U.S. has, what, 40% obesity?)
 will in fact catch it, even though they're not supposed to.
 But this is the best SWAG.

 Then we set it to a nice, round number, so it's easy to see the effects.
 Modify this in place if you don't like it; the convenience of parameter file.

could use double N_USpop_total_count = 329338025 * 0.786;  330M as of Mar 13, 2020
 that's 258,859,688 adults in play.
 I'm assuming N should be adult:adult contacts, and not the larger population.
 Here we also magically assume children do not offer any transmission (unsub.)
or double N_USpop_total_count = 260000000;  number of adults over 14,  but what we actually use is
double N_pop_total_count = 250000000;  number of adults over say 15,
 picked so it's easy to comprehend.  Clear communication is critical.

 but everyone 14 and under gets a free pass.

 Used in the S.I.R. model.
 Incremental new actual infections (delta I) =
      Beta * ( S * I ) / N.

#define DEFAULT_BETA    0.25
double Beta_transmission_rate_per_day = DEFAULT_BETA;