The new coronavirus is a pandemic worldwide, and the World Health Organization (WHO) declared a state of emergency on January 30. Attempts have long been made to predict infectious diseases by simulating infectious diseases such as coronavirus using mathematical models. In this article, we will introduce the most basic SIR model among the mathematical models of infectious disease epidemics, and perform numerical simulations using Python.
The SIR model is a classic model equation that deterministically describes the short-term epidemic process of infectious diseases [1]. The model's name comes from Susceptible, Infected, and Recovered or Post-Infected Death Removed. This model was proposed by W. O. Kermack and A. G. McKendrick in 1927. [2] This model can be represented by the following ordinary differential equations.
\begin{align}
\frac{dS(t)}{dt}&=-\beta S(t)I(t) \\
\frac{dI(t)}{dt}&=\beta S(t)I(t)-\gamma I(t) \\
\frac{dR(t)}{dt}&=-\gamma I(t)
\end{align}
Here, the meaning of each variable is as follows.
-$ S (t)
Since the SIR model is a system of ordinary differential equations, it is difficult to find a general solution. Therefore, in this article, we will use the Runge-Kutta method, which is often used in numerical calculations, for simulation. The initial conditions of the simulation are as follows (* The values used here are determined appropriately, and there is no particular basis for this).
--Population (N): 1 million
--Initial infection: 100 people
--Infection rate ($ \ beta
main.py
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
def main():
#Setting of each parameter
N = 1000000
alpha=0.5/N
beta=0.07
dt=0.1
init_SIR_value=[N-100, 100, 0] #Setting initial conditions
times = np.arange(0.0, 100, dt) #Period setting
results = odeint(SIR, init_SIR_value, times, args=(alpha,beta)) #Calculated with odeint
#Visualization
plt.title("SIR Model")
plt.plot(times[::10],results[::10,0]/N, color=(0.0,1,0.0), linewidth=1.0, label='S')
plt.plot(times[::10],results[::10,1]/N, color=(1.0,0,0.0), linewidth=1.0, label='I')
plt.plot(times[::10],results[::10,2]/N, color=(0.0,0,1.0), linewidth=1.0, label='R')
plt.xlim(0,100)
plt.legend()
plt.xlabel('day')
plt.ylabel('value')
plt.grid(True)
plt.show()
def SIR(v,t,alpha,beta):
return [-alpha*v[0]*v[1], alpha*v[0]*v[1]-beta*v[1], beta*v[1]]
if __name__ == '__main__':
main()
If you run the above program, you will get the following results.
It can be seen from the graph that the number of infected people declines after reaching a certain peak.
In this article, we introduced the SIR model, which is one of the mathematical models of infectious disease epidemics, and simulated the transition of infectious disease epidemics. Unlike infectious diseases such as influenza, the new coronavirus has a long incubation period, so it is said that this model is not suitable for application. Therefore, a mathematical model called the SEIR model that considers the incubation period has also been proposed for this model. I won't introduce this model this time, but I will introduce it in another article if I have a chance.
[1] [SIR model -Wikipedia-](https://ja.wikipedia.org/wiki/SIR model) [2] A Contribution to the Mathematical Theory of Epidemics
Recommended Posts