Skip to content

Instantly share code, notes, and snippets.

@hierophantos
Created March 12, 2020 17:18
Show Gist options
  • Save hierophantos/73fb548de506ac882109666f9770b9de to your computer and use it in GitHub Desktop.
Save hierophantos/73fb548de506ac882109666f9770b9de to your computer and use it in GitHub Desktop.
(def naive-model
"assuming that the 2 percent mortality rate applies to anyone who gets COVID19"
(let [world-population 8e9
covid-mortality-rate 0.02
percent-infected [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1]]
(->> percent-infected
(map #(* % world-population))
(map #(* % covid-mortality-rate)))))
(def severe-only-model
"assuming only those who get severely sick die. severe-only is naive-model with an extra condition"
(let [severe-cases 0.2]
(->> naive-model
(map #(* % severe-cases)))))
(comment
"According to Naive model, anywhere from 16M to 160M"
naive-model
=> [1.6E7 3.2E7 4.8E7 6.4E7 8.0E7 9.6E7 1.12E8 1.28E8 1.44E8 1.6E8]
"Assuming only 20% of cases could become fatal: 3.2M to 32Million"
severe-only-model
=> [3200000.0 6400000.0 9600000.0 1.28E7 1.6E7 1.92E7 2.24E7 2.56E7 2.88E7 3.2E7]
"50% infected, only severe cases die: 16 Million"
(get (apply vector severe-only-model) (dec 5))
=> 1.6E7
"50% infected, mortality rate applies to all infected: 80 Million"
(get (apply vector naive-model) (dec 5))
=> 8.0E7
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment