Reopening Safely: The Data Science Approach
Tags: Data Science, Coronavirus, Covid, Sir Model, Modelling

The SIR Model

The SIR model is one of the most sacred disease modeling tools. Its versatility, simplicity, and effectiveness make it one of the most powerful tools in epidemiological modeling. Here is a simple breakdown of the key ideas behind the model:

The S, I, and R

The first step in the SIR model is to break down the population into three possible states: Susceptible (S), Infected (I), or Recovered (R). The states themselves are quite self-explanatory. However, the last state, removed, is also commonly referred to as the “Removed” state because it can contain individuals who are recovered or dead.

The Dynamics

As with many problems involving populations, it is much easier to describe the change of a state rather than it is to describe the state itself. Essentially, this means that differential equations are necessary.

The equations above might look intimidating at first glance, but when understood in the right context, they make perfect sense. In order to understand these equations, we need to define a few variables, notably:

Beta = infection rate * number of individuals a person makes contact with (essentially how many people 1 infected infects) Gamma = 1 / days to recover (the recovery rate)

The first equation means that the number of people exiting the susceptible compartment per timestep is beta * I * S/N. This makes sense because each infected infects beta people (see the definition of beta). The last part, S/N, represents the portion of the population that is susceptible because an infected or recovered person cannot be reinfected*.

Now, since everyone who “leaves” the Susceptible compartment must go to the Infected compartment (you can’t jump to the Removed compartment without first being infected), the Infected compartment simply gets whatever population leaves the Susceptible compartment (notice the derivative of the Infected compartment is just the negated derivative of the Susceptible compartment with one other term). The extra term at the end represents the people leaving the Infected compartment after recovering (the recovery rate * the infected population). And lastly, the same number of people leaving the Infected compartment join the Recovered compartment.

*The idea that someone who has recovered from an illness cannot be susceptible to it again is one of the assumptions behind the SIR model which is mostly true for COVID-19

Setting it Up

Coding the SIR Model might seem quite intimidating at first, but luckily, there is a software library that can help — check out epispot on GitHub. Epispot can handle the SIR model and even more complex models (where there are exposed and hospitalized states). Coding this model in epispot will be covered in the following sections. The code itself is not that important (you can always consult the documentation), but its predictions and the reasons behind them are.

If you are interested in the code, there is one other parameter that epidemiologists frequently use (and one that epispot uses). That parameter is of course R Naught. R Naught is essentially beta / gamma or the net gain in the infected category per infected if 100% of the population is fully susceptible. Essentially, this tells epidemiologists how infectious a certain disease is (e.g. for COVID-19, this number is around 2.5).