
The SIR Model of Epidemics - luu
https://jaydaigle.net/blog/the-sir-model-of-epidemics/
======
xvilka
There is a well-maintained and popular R framework with ready SIR, SEIR, etc
models, along with a variety of examples[1] - EpiModel[2][3].

[1] [https://github.com/EpiModel/EpiModel-
Gallery](https://github.com/EpiModel/EpiModel-Gallery)

[2] [http://www.epimodel.org/](http://www.epimodel.org/)

[3] [https://github.com/statnet/EpiModel](https://github.com/statnet/EpiModel)

------
Teichopsia
Layman with absolutely no understanding about any of this.

I currently live in a country with absolutely no infrastructure to handle
this. Our first confirmed case was reported almost three weeks ago. Within a
week we ran out of testing kits.

Last night I started researching on the topic to see if there is a formula to
calculate the current number of infected people in the country. I don't care
about accuracy, it just needs to give an approximate.

The current official figure is less than ten and I feel that by having an
estimate (from what I've been able to read, time is a bad indicator, it is
what it is) it would help change what I believe to be a false sense of
security if one is looking at the official figures.

Is there any such formula or should I use the SIR model? (which currently is a
bit over my head)

~~~
the_crocodile
Tomas Pueyo published an article: [https://medium.com/@tomaspueyo/coronavirus-
act-today-or-peop...](https://medium.com/@tomaspueyo/coronavirus-act-today-or-
people-will-die-f4d3d9cd99ca)

He wrote a model that roughly estimates infection rates in a population based
on either deaths or confirmed cases:
[https://docs.google.com/spreadsheets/u/1/d/17YyCmjb2Z2QwMiRR...](https://docs.google.com/spreadsheets/u/1/d/17YyCmjb2Z2QwMiRRwAb7W0vQoEAiL9Co0ARsl03dSlw/copy)

The model is oriented around companies, but could be applied to any gathering
of people. There may be more sophisticated or accurate models out there, but I
found his relatively quick to understand and apply.

~~~
Teichopsia
Thanks.

------
acidburnNSA
And you can play with the parameters yourself using scipy:
[https://scipython.com/book/chapter-8-scipy/additional-
exampl...](https://scipython.com/book/chapter-8-scipy/additional-examples/the-
sir-epidemic-model/)

~~~
dhimes
At the risk of getting hellbanned for sneaking in reposts of my largely
ignored posts from yesterday, the projections for our current situation can be
found online here:

[http://covid19.healthdata.org/projections](http://covid19.healthdata.org/projections)

paper here: [http://www.healthdata.org/research-article/forecasting-
covid...](http://www.healthdata.org/research-article/forecasting-
covid-19-impact-hospital-bed-days-icu-days-ventilator-days-and-deaths)

~~~
noelsusman
Interesting, they're projecting the peak much earlier than other projections
I've seen, especially considering they're factoring in social distancing
measures. I'm not sure I buy it. For example, North Carolina currently has 91
patients in the hospital for COVID19. The model projected 300-1000
hospitalizations by this point, suggesting that their model is over-aggressive
with the ramp-up time.

The models I've seen with the peak in April have been the truly apocalyptic
scenarios. Most models that incorporate social distancing push the peak out
into May and beyond.

~~~
acqq
> North Carolina currently has 91 patients in the hospital for COVID19. The
> model projected 300-1000 hospitalizations by this point

The doubling time is in many places only 3 days. From my point of view the
model which is off by only a week could still be quite correct.

~~~
MR4D
The data backs you up.

The model projected 437 deaths for March 28th (tolerance bands of 380 - 508).

According to [0], the deaths were actually 264.

But the model predicted around that only two days prior ( 273 deaths on March
26th).

I’d say it’s pretty accurate - off only by a couple days.

[0] -
[https://www.worldometers.info/coronavirus/country/us](https://www.worldometers.info/coronavirus/country/us)

~~~
dhimes
Considering it was probably two doubling times (I've been seeing 2.77 days or
so as well from the jhu site) to write the paper and get it out- working
extremely hard.

------
magwa101
Many key variables change the outcomes significantly. I've heard
epidemiologists talk about reducing the "populations" down to things like
schools. But then they assume "everyone interacts with everyone". Hence they
predict very high infection rates. Michael Levitt takes into account our
typically small social circles and predicted Chinese "end" accurately (2-3%).
The message is of course, physical distancing works and with our personal
circles rather small, it works quickly. I am looking for Levitt's published
algo but no sign, I'm going by reports. He is a Stanford Prof so likely legit.

------
taylorhayduk
Numberphile did a great video on the SIR Model if you prefer a video
explanation:
[https://www.youtube.com/watch?v=k6nLfCbAzgo](https://www.youtube.com/watch?v=k6nLfCbAzgo)

------
julienchastang
On the topic of SIR, check out the 3Blue1Brown video on this topic:
[https://www.youtube.com/watch?v=gxAaO2rsdIs](https://www.youtube.com/watch?v=gxAaO2rsdIs)

------
yodsanklai
Are there alternative models? I read (not very reliable source) that SIR was
pretty naive in the sense that it doesn't model the graph of social
interactions. Also, Spanish flu didn't really follow SIR.

~~~
abhisuri97
Yes tons and tons. It's fairly easy to just imagine it as a sort of DFA/NFA. I
personally like an SIR(D) model where from the "I" state you can either
progress to recovered or dead. You can kinda take care of that in the regular
"R" case with the SIR model, but the "D" state makes the fatality of the virus
all the more visible. Additionally, you can add "Vital dynamics" to the model
by basically adding a birth rate dependent on the total size of the
reproducing population that feeds into the "S" state. You can also add a
general baseline death rate (\mu) that takes away some population from each
state in SIR. Lastly, like the sibling commenter mentioned, you can add an "E"
state where there is a state between susceptible and infected where an
individual is infected but not yet infectious. All that is added are more
letters and computational time :)

~~~
gbrown
> computational time

Understatement of the century lol, especially for fully Bayesian versions.

------
joe_the_user
Interesting in the abstract but we know that even simpler model works well in
the case of the epidemic we're sadly watching.

In this model, change in the number of people is function of the number of
people infect, that's it. The number of potentially infectable people is so
large that changes in it's value won't enter into consideration until the US
is at WWII-invasion level of fatalities.

dS/dt = Sr, for some value of r.

 _A simple differential equation indeed_ , solved by S = e^(t*R); exponential
growth as we see (note, I'm not claiming my r here is R0 or whatever).

~~~
jaydaigle
You're totally right, of course. And I even mention that in the post. If we
assume that S ~ N then we get that exponential growth. But eventually
(unfortunately) enough people will get sick that S is no longer close to N;
that's why the epidemic peaks.

------
twic
A friend who is a former epidemiologist, writing about some of his work in
another place:

> Also, mine is a SIRD model (guess what the D stands for). People didn't use
> to include mortality in these because it depletes the population you are
> trying to simulate, but I've been able to run large enough numbers that you
> can include it as long as your disease is not too lethal ... and if it is
> that's also a result of sorts.

~~~
TheGallopedHigh
Depends on the type of model, but death and birth and everything in between
has been put into these models. Feel free to peruse any of the literature.

------
rs86
How could one add undertesting to the model?

~~~
shawnz
Testing isn't part of the model at all, it operates only on the true numbers
of susceptible/infected/recovered. Testing only gives you an idea of what
those might be.

~~~
pugworthy
That said, it does have the potential to impact the _perception_ of danger to
individuals. And perception of danger should influence the β factor the author
mentions. Learning that a lot of people have it or a lot of people are dying
for example may cause people to take it more seriously, and thus influence β.

------
esoterae
Don't assume the data going into this model has anything to do with reality.
There's a very, very good reason that the China data almost perfectly fits a
curve. That's because they used a quadratic equation to generate the data.

The lines of hundreds/thousands of people waiting to recover the ashes of
relatives from several cremation facilities, along with the documented arrival
of roughly 45,000 urns to Wuhan alone belies the rotten data that even now
claims only 3,300 total deaths in .cn

~~~
danharaj
If China is understating the damage from the virus they are only doing it by a
constant factor at best. You cannot hide an exponentially growing epidemic, no
matter how hard you try. That's just how it is on this bitch of a function.

Western propaganda has trained its people to think the Chinese communist party
is as stupid as it is authoritarian. Quick quiz, if you don't know who Li
Keqiang is then you more likely than not treat the CCP as a black box
controlled by Winnie the Pooh.

~~~
esoterae
Just following up to point out the subsequent publication of the existence of
a report by US intelligence services indicating a massive cover-up of actual
SARS-CoV-2 involvement statistics for Wuhan and across all of mainland China.

I submit
[https://www.reddit.com/r/dataisbeautiful/comments/ez13dv/oc_...](https://www.reddit.com/r/dataisbeautiful/comments/ez13dv/oc_quadratic_coronavirus_epidemic_growth_model/)
as illustrating my earlier point.

I also submit
[https://www.taiwannews.com.tw/en/news/3871594](https://www.taiwannews.com.tw/en/news/3871594)

