Understanding the SIR Model

Jordan Crosby
4 min readApr 21, 2020

--

how does the SIR Model work mathematically?

This explanation is rooted in my previous article that breaks down the elements of a virus and how an epidemic works. You can read it here

A virus has a 2 important properties that determine the way it spreads through a population:

The Reproductive Number is the average number of individuals that one infected person will infect during the course of the illness.

The Recovery Time is the expected amount of time it takes for an individual to recover from the virus.

These values are used to derive the Daily Reproductive Number and Daily Recovery Number.

At the Macro Level, these numbers are simply a growth rates.

the Daily Reproductive Number is the percentage growth of Infected Individuals each day.

the Daily Recovery Number is the percentage decrease of Infected Individuals each day.

As equations, is can be expressed like this:

I(t) is the Number of Infected Individuals at Day (t)

Lets again break our Population (N) into the three categories:

  • Susceptible Individuals (S)
  • Infected Individuals (I)
  • Recovered Individuals (R)

An important ratio is the proportion of Susceptible Individuals S(t) to the entire population at each day (t):

If we think back to infections being interactions, this is the percentage of successful interactions that the infected have with susceptible individuals.

We can also define the number of Recoveries that happen each day as this:

We use these values each day as the building blocks for our model over a interval of Days (t):

Each day the number of Susceptible Individuals shrinks by the amount infected.

The number of Infected Individuals increases by the amount infected, and decreases by the amount recovered.

The number of Recovered Individuals increases by the amount recovered.

The rates of change are easily derived from these as just moving variables from the right side to the left:

These are the rates of change that define our model for infectious diseases. If we define the variables, and start iterating over Day 1, Day 2, Day 3 we can see the SIR curve:

In Python we can model this:

These are the rates of each category at every Day (t).

If we define our variables, we can then integrate these equations over time to get the number of individuals in each category at all times.

Our output is this:

  • Day 1: 9900 Susceptible, 100 infected, 0 Recovered
  • Day 10: 6941 Susceptible, 2348 infected, 710 Recovered
  • Day 20: 700 Susceptible, 4002 infected, 5296 Recovered
  • Day 30: 191 Susceptible, 1916 infected, 7892 Recovered

This over time looks like this:

The underlying math for deriving the SIR Model is very straightforward. I think thats the reason I’m so fascinated with this methodology. It’s effective, simple, and intuitive.

In future articles I will break down these equations even more to highlight important times on the curve that indicate the course of the virus is changing.

--

--

Jordan Crosby

interested in automation and data and epidemeology. learn more about me at jcros.me