SEIR EPIDEMIOLOGICAL MODEL

Objective: To analyse the dynamics of the Susceptible-Latent-Infectious-Recovered (SEIR) epidemic model.

Remove all objects from workspace.

remove (list = objects())

Load add-on packages - deSolve - contains lsoda function - differential equation solver.

library (deSolve)
## 
## Attaching package: 'deSolve'
## 
## The following object is masked from 'package:graphics':
## 
##     matplot

Function to compute derivatives of the differential equations.

seir_model = function (current_timepoint, state_values, parameters)
{
  # create state variables (Local variables)
  S = state_values [1]        # susceptibles
  E = state_values [2]        # exposed 
  I = state_values [3]        # infectious
  R = state_values [4]        # recovered
  
  with (
    as.list (parameters),     # variable names within parameters can be used
  {
    #compute derivatives
    dS = - (beta * I  * S) + ((1-v) * mu) - (mu * S) - (lamda * S)              
    dE = (beta * S* I) - (delta * E ) - mu *E - (lamda *E)
    dI =  delta * E - (gamma  * I) - mu * I - (lamda * I)
    dR = gamma * I  - (mu * R) - (v *mu) - (lamda * R)

    
    # combine results
    results = c (dS, dE, dI, dR)
    list (results)
    }
  )
}

Parameters

transmission_rate = 1.13               # transmission rate
infectious_period = 7               # infectious period
latent_period = 7                   # latent period
aging = 0.167
proportion_vaccinated = 0.34
birth_rate = 0.013
death_rate = 0.013

Compute values of beta (transmission rate), gamma (recovery rate) and delta

beta_value = 1.13
lamda_value = 0.167
v_value = 0.34
mu_value = 0.013
delta_value = 1 / latent_period
gamma_value = 1 / infectious_period

Compute Ro - Reproductive number.

Ro = beta_value / gamma_value

Disease dynamics parameters

parameter_list = c (beta = beta_value, delta = delta_value, gamma = gamma_value, lamda = lamda_value, mu = mu_value, v = v_value)

Initial values for sub-populations.

W = 6850        # susceptible hosts
X = 2000           # exposed hosts
Y = 150           # infectious hosts
Z = 1000           # recovered hosts

Compute total population.

N = W + X + Y + Z

Initial state values for the differential equations.

initial_values = c (S = W/N, E = X/N, I = Y/N, R = Z/N)

Output timepoints.

timepoints = seq (0, 50, by=1)

Simulate the SEIR edipemic

output = lsoda (initial_values, timepoints, seir_model, parameter_list)

Plot dynamics of Susceptibles sub-population.

plot (S ~ time, data = output, type='b', col = 'blue')  

Plot dynamics of Exposed sub-population

plot (E ~ time, data = output, type='b', col = 'black')

Plot dynamics of Infectious sub-population.

plot (I ~ time, data = output, type='b', col = 'red') 

Plot dynamics of Recovered sub-population.

plot (R ~ time, data = output, type='b', col = 'green')

Plot dynamics of Susceptibles, Exposed, Infectious and Recovered sub-populations in the same plot.

# susceptible hosts over time
plot (S ~ time, data = output, type='b', ylim = c(0,1), col = 'blue', ylab = 'S, E, I, R', main = 'SEIR epidemic') 

# remain on same frame
par (new = TRUE)    

# exposed hosts over time
plot (E ~ time, data = output, type='b', ylim = c(0,1), col = 'black', ylab = '', axes = FALSE)

# remain on same frame
par (new = TRUE) 

# infectious hosts over time
plot (I ~ time, data = output, type='b', ylim = c(0,1), col = 'red', ylab = '', axes = FALSE) 

# remain on same frame
par (new = TRUE)  

# recovered hosts over time
plot (R ~ time, data = output, type='b', ylim = c(0,1), col = 'green', ylab = '', axes = FALSE)

# remain on same frame
par (new = TRUE) 

legend ("topright", legend=c("S","E","I","R"), col=c(4,1,2,3), lwd=2, cex=0.7)

COMMENT:

The SEIR epidemic model shows over time the number of susceptible hosts (blue), exposed hosts (purple), infectious hosts (red) and recovered hosts (green) over time. At the early stages of the epidemic, a larger part of the population is susceptible. As in the SIR epidemiological model, the number of susceptible hosts decreases over time as the number of recoverd hosts increases. The SEIR model also adds the exposed stage as a condition for becoming infectious, which helps decrease the number of infectious hosts over time. The number of infectious hosts increases until around day 30, and starts decreasing (Ro ≤ 1).