[PYTHON] Hypothesis of why the new coronavirus is not so common in urban areas such as Tokyo

Introduction

If you check the transition of the number of people infected with new coronavirus infection (COVID-19) on Map of new coronavirus infected people by prefecture etc. As of March 7, 2020, there are a considerable number of people locally, including 98 in Hokkaido and 21 in Sagamihara, while there are 73 in Tokyo, 41 in Osaka, and 8 in Kyoto. It is an impression that there are relatively few in urban areas where there should be a lot of traffic. The number of infected people is surprisingly small in urban areas, even though hundreds of thousands or millions of people commute to work, go to school or go sightseeing every day and work in contact with each other in densely populated areas. It's very strange, isn't it? Therefore, in this article, I made a hypothesis and tested whether the reason could be explained using a mathematical model. Please refer to Article posted the other day for the basic tooling.

the term

As I wrote in Previous article, I will review the basic terms.

Also, use the following parameters.

hypothesis

By the way, the hypothesis proposed in this article is, in a nutshell, ** the purification effect of the commuter town **. First of all, please see the figure below. COVID-Tokyo.jpg First, define the words.

As shown in the figure, S1 people in the suburbs commute to work and school, and S2 people in the city join at the same school or workplace. There, the infected person I is infected and becomes E1 and E2, respectively. From E1 and E2, transition to I1 and I2, respectively, and finally to R1 and R2. However, of the I1s living in the suburbs, only those with a certain ratio of r $ (0 \ leq r \ leq 1) $ shall commute to work or school again in the urban area. The remaining ratio 1-r people shall not move to urban areas by waiting at home or being hospitalized. From this flow, we made the following hypothesis.

SEIR model modifications

The above hypothesis is modified by the SEIR model and expressed as a mathematical formula. Let's look.

\frac{dS_1}{dt}
 = - \frac{R_0}{ip} (I_2 + r I_1) \frac{S_1}{S_1 + S_2} , S_1 \geq 0
 \\
\frac{dS_2}{dt}
 = - \frac{R_0}{ip} (I_2 + r I_1) \frac{S_2}{S_1 + S_2}, S_2 \geq 0
 \\
\frac{dE_1}{dt}
 = -\frac{dS_1}{dt} - \frac{1}{lp} E_1 \\
\frac{dE_2}{dt}
 = -\frac{dS_2}{dt} - \frac{1}{lp} E_2 \\
\frac{dI_1}{dt}
 = \frac{1}{lp}E_1 - \frac{1}{ip} I_1 \\
\frac{dI_2}{dt}
 = \frac{1}{lp}E_2 - \frac{1}{ip} I_2 \\
\frac{dR_1}{dt}
 = \frac{1}{ip} I_1 \\
\frac{dR_2}{dt}
 = \frac{1}{ip} I_2 

In the first two equations, the secondary infected person produced by the infected person (I2 + rI1) is apportioned by S1 and S2. Other formulas are the same as the SEIR model.

Try to calculate with Python

Let's calculate the above hypothesis in Python. Import the library.

import numpy as np
import matplotlib.pyplot as plt

Define a function that computes R0.

def COVID19R0(er):
    if np.random.rand() < er:
        # good environment
        if np.random.rand() < 0.8:
            R0 = 0
        else:
            R0 = np.random.randint(1,4)*1.0
    else:
        # bad environment
        R0 = np.random.randint(0,12)*1.0
    return R0

Define the ODE.

def seir_eq6(v,t, keys):
    er = keys['er']
    lp = keys['lp']
    ip = keys['ip']
    r  = keys['r']
    #
    R0 = COVID19R0(er)
    #
    s1 = v[0]; s2 = v[1]
    e1 = v[2]; e2 = v[3]
    i1 = v[4]; i2 = v[5]
    r1 = v[6]; r2 = v[7]    
    #
    ds1 = - R0/ip * (i2 + r * i1) * (s1/(s1 + s2)) if s1 >= 0 else 0 # note: s1 >= 0
    ds2 = - R0/ip * (i2 + r * i1) * (s2/(s1 + s2)) if s2 >= 0 else 0 # note: s2 >= 0
    de1 = -ds1 - (1/lp) * e1
    de2 = -ds2 - (1/lp) * e2
    di1 = (1/lp)*e1 - (1/ip)*i1
    di2 = (1/lp)*e2 - (1/ip)*i2
    dr1 = (1/ip)*i1
    dr2 = (1/ip)*i2
    return [ds1, ds2, de1, de2, di1, di2, dr1, dr2]

Define a function to solve the ODE.

def my_odeint(deq, ini_state, tseq, keys):
    sim = None
    v = np.array(ini_state).astype(np.float64)
    dt = (tseq[1] - tseq[0])*1.0
    for t in tseq:
        dv = deq(v,t, keys)
        v = v + np.array(dv) * dt
        if sim is None:
            sim = v
        else:
            sim = np.vstack((sim, v))
    return sim

Finally, the code for simulation and display.

ini_state=[430, 999, 0, 0, 0, 1, 0, 0]
t_max=180
dt=0.01
t=np.arange(0,t_max,dt)
#
keys = {'er':0.5, 'lp':5.5, 'ip':8, 'r':0.01 }
sim = my_odeint(seir_eq6, ini_state, t, keys)
#
plt.rcParams["font.size"] = 12
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(t,sim[:,[4,5]]) # extract Infected1, Infected2
ax.set_xticks(np.linspace(0,t_max,19))
yw = 100; yn = int(500/yw)+1
ax.set_yticks(np.linspace(0,yw*(yn-1), yn))
ax.grid(which='both')
ax.legend(['Infected1(Outside)','Infected2(in City)'])
ax.set_xlabel('date')
plt.show()

Let's calculate some patterns by changing the S1 and S2 parts of init_state. The ratio r is assumed to be 0.01. In addition, other parameters are the same as Previous article.

simulation result

We will start from the state where the population of the urban area is 1000 and there is one infected person on the 0th day (S2 = 999, I2 = 1). 1000 people is a tentative value for ease of calculation.

The first is when the inflow S1 from the suburbs is 0.

m6_2_s1_0_all.png

The number of infected I2 in urban areas peaked at about 320 on the 62nd day.

This is the case when the inflow S1 from the suburbs is 50%.

I started from S1 = 500. m6_2_s1_50_all.png The number of infected I2 in urban areas peaked at about 260 on the 102nd day. In other words, the peak is delayed by about 40 days, and the number of people infected with the peak is reduced by about 19%. By the way, according to Tokyo Metropolitan Press Material, the 2015 census As a result of

Therefore, the ratio of S1 and S2 is 430: 1000 as a guide.

This is the case when the inflow S1 from the suburbs is 80%.

I started from S1 = 800. m6_2_s1_80_all.png The number of infected I2 in urban areas peaked at about 210 on the 142nd day. In other words, the peak is delayed by about 80 days, and the number of peak infected people is reduced by about 34%. There seems to be a lot of numbers of 80%, but according to this page, "In 2018 The number of foreign tourists visiting Tokyo was about 14.24 million, and the number of Japanese tourists was about 536.5 million. ”So, by simple calculation, 1.5 million people will flow in every day. I will.

Consideration

From the above, the following trends can be derived from the simulation regarding the peak fluctuation of infection due to the infected person staying in the suburbs (waiting at home / hospitalized in the suburbs) while the population flows from the suburban commuter town to the urban area.

Therefore, it seems that the ** purification effect of the bed town ** is reasonable.

Furthermore ...

Reference link

I referred to the following page Map of people infected with new coronavirus by prefecture Overview of the daytime population of Tokyo (population by place of employment / school) Fact-finding survey on the number of tourists visiting Tokyo in 2018 SEIR model Infectious disease mathematical model beginning: Overview of SEIR model using Python and introduction to parameter estimation Verify the effect of leave as a countermeasure against the new coronavirus with the SEIR model

Recommended Posts

Hypothesis of why the new coronavirus is not so common in urban areas such as Tokyo
Factfulness of the new coronavirus seen in Splunk
Let's test the medical collapse hypothesis of the new coronavirus
Think about why Kubernetes is described as "Linux in the cloud"
If the accuracy of the PCR test is poor, why not repeat the test?
Plot the spread of the new coronavirus
Create a bot that posts the number of people positive for the new coronavirus in Tokyo to Slack
Estimate the peak infectivity of the new coronavirus
The update of conda is not finished.
What is the reason why the basic commands are not displayed in Japanese in man?
Why Docker is so popular. What is Docker in the first place? How to use