[PYTHON] Severe Acute Respiratory Syndrome: Understanding the Role of Social Distance Strategy with a Simple Model

ecmo usage (Japan Society for Intensive Care Medicine) The number of ECMOs worn has decreased.

image.png

Understand the mechanism of infection with the new coronavirus with a simple model and practice social distancing.

I created a simple infection model that anyone can understand so that they can understand why activity needs to be reduced by 80%. It's enough to get a general idea of the situation.

First, let's assume that the number of people is constant. Suppose there is no new life or no life to disappear. Next, divide the people into three groups. Those who can get infected, those who get infected, and those who have recovered. What is important here is that the person who has recovered is immune and will never be infected again. It is expressed as follows. image.png

Creating your own model will increase your understanding of infection and give you a better idea of what to do.

The simplest model

Let S be the number of people who can be infected. I think that one person is infected first and it spreads. The method of propagation is as follows.

A potentially infected person comes into contact with a person. Let C be the number of people or activity that the person contacts in a day. The probability that the next person to be contacted is an infected person is defined as unluck. Then, among the people who come into contact, the infected person becomes C x unluck. And if the probability of being infected by contact with an infected person is beta, the number of non-immune people who can be infected is S, so the number of newly infected people new_I is

new_I = S(t) x C x unluck x beta

Will be. Then the number of infected people I

I(t+1) = I(t) + new_I

Will be. However, even if infected, there is a possibility that they will recover by getting immunity by themselves. Let the ratio be gamma per day. If the number of people recovering in one day new_R is the number of infected people I (t) x gamma,

new_R= I(t) x gamma

Will be.

The number of infected people

I(t+1) = I(t) + new_I - new_R

Will be. It is assumed that a person will always recover from the infection, be immunized, and never be infected again. Let R be the number of people who will never get infected

R(t+1) = R(t) + new_R

The number of infected people S

S(t+1) = S(t)-new_I

Therefore,

S (t + 1) + I (t + 1) + R (t + 1) = S (t)-new_I + I (t) + new_I-new_R + R (t) + new_R = S (I) + I (t) + R (t) = S (0) + I (0) + R (0) = constant

Will be.

Let's program.

#Initialization
%matplotlib inline
import matplotlib.pyplot as plt

Next, the number of new infected persons is plotted.

S=1000 # the number of people without immunity
beta=0.2 #rate of infection
gamma=0.1 #recovery rate
I=1
R=0
alpha=I/(S+I+R)
C=2 # the number of person to meet/contact
inf=[]
sus=[]
rec=[]
for t in range(100):
    alpha=I/(S+I+R)#infection rate of contact person
    new_R=I*gamma
    new_I=S*C*alpha*beta
    if new_I<0:
        new_I=0
    I=I+new_I-new_R
    R=R+new_R
    S=S-new_I
    if S<=0:
        S=0
    inf.append(I)
    sus.append(S)
    rec.append(R)
    #print(t,new_inf,n)
plt.plot(inf,label='infection')
plt.plot(sus,label='susceptible')
plt.plot(rec,label='recover')
plt.legend()

image.png

Next, let's increase the number of contacts in order to understand the role of social distancing. Change c = 2 in the above code to c = 10.

image.png

The number of infected people is increasing, and the peak period is coming soon. This will flood the hospital with patients.

Next, try reducing the number of contacts. Try setting c = 1 in the program code.

As expected. The number of infected people has decreased and has shifted to the peak. This keeps the hospital from getting crowded.

image.png

In any case, there is no choice but to recover by self-immunity. The first two eventually infect almost everyone and do not converge until almost everyone is immune. The last example is ambiguous. In all simulations, the maximum step value is 100 (range (100)). Let's set this to 1000 (range (1000).

image.png

If we reduce contact with people, slow down the rate of infection, and recover with our own immunity, there will be no infected people and no infected people. Not everyone gets infected. This is the reason for taking a social distance strategy!

The Wiki SIR Model (https://en.wikipedia.org/wiki/SIR%E3%83%A2%E3%83%87%E3%83%AB) puts C x alpha x beta as beta. .. In general, the infection rate is a number that does not limit the people to contact, and the treatment of the model here is an exception.

In this model, the state of coronavirus infection is

It is expressed much easier than it really is.

There are deaths in the coronavirus.

There is an incubation period.

There is a reinfection after recovery from the infection.

It takes a long time to confirm the infection.

The method of infection is non-linear and increases at an accelerating rate, but in this model it is expressed simply as a proportional relationship.

The infection in this model is like influenza and the infection is transmitted uniformly from the patient. However, in the case of cluster infection, managing the cluster can rapidly suppress the infection.

There is a point that even such a simple model is good.

Easy to understand.

In the current situation without drugs, it is important to understand the basic mechanism of infection with this model. If you have medicine, it's important to start treatment, but that's not the case now. Then, it is important not to come into contact with people anyway.

Reducing the infection rate leads to restrictions such as washing hands, attaching a mouse, and not going to crowds. Vaccines are one of them. However, while it is important to reduce the infection rate by such actions, there are limits. Try changing the beta of the model in various ways.

This model emphasizes that currently the only way to reduce infection rates is to avoid contact with people.

Also, in order to increase the recovery rate, it is necessary to stay as quiet as possible and not to contact people.

Examples of more complex situations:

A case where the virus is retained even if it seems to have recovered and it recurs.

image.png

Situations where medicine can be prepared and treated

image.png

Situation where vaccination is possible

image.png

It takes time to notice the infection

image.png

A recent state of emergency calls for reducing contact with as many as 80% of people. But actually, it hasn't decreased by 50%. Check with a simple model

From step 20, using the if statement (if t> 20 :), C = 2 was reduced by 80% to C = 2 * 0.2 = 0.4.

S=1000 # the number of people without meneki
beta=0.2 #rate of infection
gamma=0.1 #recovery rate
I=1
R=0
alpha=I/(S+I+R)
C=2 # the number of person to meet
inf=[]
sus=[]
rec=[]
for t in range(100):
    if t>20:
        C=2*0.2
    alpha=I/(S+I+R)
    new_R=I*gamma
    new_I=S*C*alpha*beta
    if new_I<0:
        new_I=0
    I=I+new_I-new_R
    R=R+new_R
    S=S-new_I
    if S<=0:
        S=0
    inf.append(I)
    sus.append(S)
    rec.append(R)
    #print(t,new_inf,n)
plt.plot(inf,label='infection')
plt.plot(sus,label='susceptible')
plt.plot(rec,label='recover')
plt.legend()

image.png

The result is good. Infection is suppressed. Next, let's make it 50%. Let C = 2 * 0.5 in the first if.

image.png

It is not much different from the first orbit. After all it is useless unless it is reduced by 80%. It is said that 80% is difficult even in the blockade of cities in Europe and the United States. Right now, an autonomous system is required. Let's do our best voluntarily, not because someone tells us.

According to the subway usage status announced by the Tokyo Metropolitan Government, the reduction target has not been achieved. The usage reduction target is 80%, and now it is 50%.

If medical collapse is not prevented, the convergence of infection will be prolonged

[Spanish flu](https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%9A%E3%82%A4%E3%83%B3%E3%81%8B%E3% It took three years (January 1918-December 1920) to converge (81% 9C).

[The disruption of the medical system, not the virulence of the virus, prolonged the convergence of the infection](https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%9A%E3% 82% A4% E3% 83% B3% E3% 81% 8B% E3% 81% 9C). [Infection and reduction of doctors and nurses leads to medical collapse](https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%9A%E3%82%A4%E3% 83% B3% E3% 81% 8B% E3% 81% 9C). Protecting healthcare professionals protects society.

Convergence of Asian Cold It takes 1-2 years (February 1957-1958).

Occurred in Guizhou and Yunnan provinces of the People's Republic of China in 1956 In Japan, it occurred in May 1957, and two waves converged in early spring 1958.

New Coronavirus Information Dissemination by Shinya Yamanaka is full of valuable information.

Recommended Posts

Severe Acute Respiratory Syndrome: Understanding the Role of Social Distance Strategy with a Simple Model
Analyze the topic model of becoming a novelist with GensimPy3
Evaluate the performance of a simple regression model using LeaveOneOut cross-validation
I tried to create a model with the sample of Amazon SageMaker Autopilot
A model that identifies the guitar with fast.ai
[Python] A rough understanding of the logging module
I tried to make something like a chatbot with the Seq2Seq model of TensorFlow
Verify the effect of leave as a countermeasure against the new coronavirus with the SEIR model