[PYTHON] Mathematical model of infectious disease epidemics

Introduction

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.

What is a SIR model?

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) : Number of uninfected persons at time t - I (t) : Number of infected people at time t - R (t) : Number of recoverers or deaths at time t - \ beta : Infection rate - \ gamma $: Recovery rate or quarantine rate

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 ): 0.0000005 --Recovery rate ( \ gamma $): 0.07

Source code

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()

Simulation results

If you run the above program, you will get the following results.

figure_1.png

It can be seen from the graph that the number of infected people declines after reaching a certain peak.

in conclusion

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.

References

[1] [SIR model -Wikipedia-](https://ja.wikipedia.org/wiki/SIR model) [2] A Contribution to the Mathematical Theory of Epidemics

Recommended Posts

Mathematical model of infectious disease epidemics
Solving mathematical models of infectious disease epidemics in Python
Predict infectious disease epidemics with SIR model
Introduction of mathematical prediction model for infectious diseases (SIR model)
Implement the mathematical model "SIR model" of infectious diseases with OpenModelica
[Introduction to infectious disease model] All parts of Japan are ending ... ♬
Test Mathematical Part 2 (Mathematical model of item reaction theory)
Implement the mathematical model "SIR model" of infectious diseases in OpenModelica (see the effect of the vaccine)
Mathematical prediction model for infectious diseases (SIR model): Case study (1)
Implement the mathematical model "SIR model" of infectious diseases with OpenModelica (example of repeating regulation and deregulation)
Implement the mathematical model "SIR model" of infectious diseases in OpenModelica (reflecting mortality rate and reinfection rate)
[Introduction to infectious disease model] I tried fitting and playing ♬
Benefits of refining Django's Model