SEIR Analysis on Covid-19 India Data
By: Alekh Sinha
Tags: Machine Learning, Şeir, Covid 19, Covid 19 Crisis, Coronavirus

This article aims to to apply SEIR model (Susceptible ,Exposed, Infected, Recovered) on the Covid-19 India data. The source of this data is https://www.kaggle.com/sudalairajkumar/covid19-in-india. This data is updated everyday. For this article I have used data till 13th April 2020.

This article contains

1>Brief Introduction to SEIR

2.>Python code to implement SEIR

3> How to consider intervention in SEIR Model.

Brief introduction to SEIR

This method divides the population to four compartments.

Susceptible(S)- It represents number of people who are not currently infected but are likely to be infected by the disease.

Exposed(E)- It represents number of people who are exposed to coronavirus but due to latency period(incubation period) they have no symptoms in their body.

Infectious(I)- It represents number of people who all are infected and well capable of transmitting this disease.

Recovered(R)- It represents number of people who are either cured or died. Please note there is no separate death compartment in this model.

Relation between these four compartments are given by set of differential equations:

Please note that sum of these differential equation is zero which means that whatever goes from one compartment comes in other compartment. This means that susceptible persons may move in expose compartment when they will come in contact with the infected persons.Some of the person from the exposed compartment will move to infected compartment based on the incubation period and some infected person will recover based on the recovery time required during treatment.At any time, the sum of all these compartments will be equal to the total population.

In these equations β can be taken as rate of contact between the infected and susceptible persons while γ is simply rate of recovery or average time taken by infected persons to recover. a is incubation period. Above equation also has terms for death rate and birth rate but in this analysis we will not consider those.

How to use these information on Covid-19 India data?

In India with whatever data we have, most of the infected people are taking around 15–25 days to recover so for this article γ can be 1/25. Incubation period of corona is about 5.2 days(debatable but in most article it is 5.2) so for this article a is 1/5, but we don’t know β.We will use curve fit to determine this parameter β. Scipy, (a package in python) has some tool for curve fit and also for solving differential equation.

Creating a function for solving differential equation

# Total population, N.

N = 1210568111

# Initial number of infected and recovered individuals, I0 and R0.

I0, R0 = 1, 0

E0=0

# Everyone else, S0, is susceptible to infection initially.

S0 = N — I0 — R0

# Contact rate, beta, and mean recovery rate(rec),incubation period(gamma),

beta, gamma,rec = 5,5,25

# A grid of time points (in days)

t = df_train[‘days’]

x_test = df_test[‘days’]

# The SIR model differential equations.

def deriv(t, y, N,gamma,rec,beta):

S, E, I,R = y

dSdt = -beta * S * I / N

dEdt = (beta * S * I / N) — ((1/gamma) * E)

dIdt = ((1/gamma) * E)-((1/rec)*I)

dRdt = (1/rec) * I

return dSdt,dEdt, dIdt, dRdt

In the above code snippet, deriv is the name of the function which will generate the required differential equations. Now these differential equations will be solved by another function.