Predicting the Spread of Infectious Disease: An SIR Model Approach

Santhosh Kannan
featurepreneur
Published in
4 min readApr 7, 2023

What is Mathematical Modeling?

Mathematical Modeling is the process of describing a real-world system using mathematical structures, equations, and functions. It is used to describe, analyze and predict various real-world systems like the spread of infectious disease, the interaction of species in an ecosystem, design and optimization in engineering, etc.

How is mathematical modeling used in Epidemiology?

Mathematical modeling is used in epidemiology to study the spread of infectious diseases through the population. This helps in understanding the transmission of the disease and predicting the extent of the outbreak. It can also be used to evaluate the impact of vaccination programs, social distancing, and the use of masks.

What is the SIR Model?

The SIR Model is one of the most commonly used models to study the spread of infectious diseases in a population. The model gets its name from the three groups of the population according to this model — Susceptible, Infected, and Recovered. The model tracks the number of people in each group over time.

Susceptible refers to people who have not been infected yet but can get infected if they come into contact with an infected person. Infected refers to people who are currently infected with the disease and can spread it to susceptible people. Recovered refers to the people who have recovered from the disease and are no longer infectious.

What are the equations for the SIR Model?

Let N be the total population. Let S(t), I(t), and R(t) represent the number of susceptible, infected, and recovered people at time t respectively. The total population is spread across these three groups.

Let Beta and Gamma represent the rate of infection of the susceptible population and the rate of recovery of the infected population respectively.

The rate of change of the susceptible population, infected population, and recovered population concerning time is as follows:

The rate of change of the susceptible population depends on the interaction between the susceptible population and the infected population and the infection rate. The negative time indicates that the susceptible population decreases over time.

The rate of change of recovered people depends on the number of infected population and the rate of recovery. The positive sign indicates that the recovered population increases over time.

The rate of change of the infected population depends on the number of people who get infected and number of people who get recovered.

Implementation of the SIR Model in Python

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint

def dAdt(A,t,beta,gamma,N):
S = A[0]
I = A[1]
R = A[2]
return [
-beta*S*I/N,
beta*S*I/N - gamma*I,
gamma*I
]

days = np.arange(0, 100, 1)
GAMMA = 0.1
N = 1e7
BETA = 0.39
S0, I0, R0 = N-500, 500, 0

sol = odeint(dAdt,y0=[S0,I0,R0], t=days,args=(BETA,GAMMA,N))

S,I,R = sol.T[0],sol.T[1],sol.T[2]

plt.plot(days,S)
plt.plot(days,I)
plt.plot(days,R)
plt.show()

Here, we run the model for 100 days. The total population is taken as 10 million, the initial infected population is 500 and the initial recovered population is null.

How does the SIR Model help?

  • Predicting the extent of the spread of the disease will help public health officials make informed decisions to slow or stop the spread of the disease.
  • It can be used to evaluate the effectiveness of measures like vaccination camps, social distancing, and quarantine policies.
  • Help healthcare officials to allocate resources such as beds and medical supplies to respond to the disease appropriately.

What are the limitations of the SIR Model?

  • Assumes that all individuals have the same likelihood of getting infected. In reality, different groups of people have different levels of susceptibility to the disease.
  • Assumes that the population is closed, that is, no new individuals enter or leave the population.
  • Assumes that all infected individuals recover from the disease and become immune to it. It does not take into consideration that people may never recover and also may get re-infected in the future.

--

--