Last active
November 29, 2021 21:33
-
-
Save scotchi/3105935d8e2c4233ea46adc4162bd449 to your computer and use it in GitHub Desktop.
Very simple model to try to calculate how long it'll be before everyone on the planet has had Covid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'active_support/all' | |
ACTIVE_CASES = 25000000.to_f | |
TOTAL_WORLD_CASES = 260000000.to_f | |
INCUBATION_DAYS = 3 | |
RECOVERY_DAYS = 10 | |
WORLD_POPULATION = 8600000000 | |
R = 1.135 | |
currently_infected = ACTIVE_CASES | |
incubating = [] | |
recovering = [ ACTIVE_CASES ] | |
total_infected = TOTAL_WORLD_CASES | |
day = 0 | |
while total_infected < WORLD_POPULATION | |
day += 1 | |
recovering.push(incubating.shift) unless incubating.size < INCUBATION_DAYS | |
recovering.shift if recovering.size > RECOVERY_DAYS | |
incubating.push(recovering.sum * (R / RECOVERY_DAYS.to_f)) | |
total_infected += incubating.last | |
printf("Day: %i, New cases: %s, Total infected: %s\n", | |
day, | |
incubating.last.to_s(:rounded, precision: 2, separator: '.', delimiter: ','), | |
total_infected.to_s(:rounded, precision: 2, separator: '.', delimiter: ',')) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When will everyone on the planet have had Covid by?
Weirdly, this is a statistic that I haven't heard talked much about: when should Covid saturate the human population?
Obviously a real world epidemiological model would be a lot more complicated, but I wanted to start with the basic numbers that we hear all the time:
I computed the r-value since the beginning of the pandemic. It's around 1.135. Everyone should have had Covid by:
This model doesn't count for reinfections. It also takes the current counted number of Covid infections, which is almost certainly severely under-reported. It's also extremely simplistic, but makes it possible to play around with the implications of different values.