In this lesson, we will study the SEIR model—a compartmental model widely used in epidemiology—with a focus on understanding the exposed compartment, which represents individuals who have been exposed to a disease but are not yet infectious. To bring these concepts to life, we’ll apply the SEIR model to a real-world example, Hepatitis E Virus (HEV).
By the end of this lesson, you should be able to:
The following packages are necessary for this lesson:
The classic SIR model assumes individuals become infectious immediately upon exposure. However, many diseases exhibit a latent period — a stage where individuals have been exposed but are not yet infectious. The SEIR model addresses this by adding an Exposed (E) compartment, providing a more realistic framework for modeling diseases with incubation periods.
In the SEIR model, we add an Exposed (E) compartment to account for the latent period — the time between exposure to the virus and becoming infectious. This stage is crucial for understanding how diseases actually progress.
The SIR model assumes that individuals are immediately infectious upon exposure, but many diseases have an incubation period. The SEIR model captures this delay, making it more accurate for diseases like Hepatitis E Virus (HEV), influenza, and measles. By including the E compartment, we model both the incubation period and the infectious period separately, reflecting a more realistic course of infection.
The SEIR model divides a population into four compartments:
And three critical parameters:
The SEIR model can be described by a system of differential equations:
where:
Let’s define the parameters, initial conditions, and time span for our model.
Define the SEIR model as a function in R.
Use the ode() function from the deSolve
package to solve this system.
Plot the model output to visualize the changes over time in each compartment.
ggplot(seir_out, aes(x = time)) +
geom_line(aes(y = S, color = "Susceptible")) +
geom_line(aes(y = E, color = "Exposed")) +
geom_line(aes(y = I, color = "Infectious")) +
geom_line(aes(y = R, color = "Recovered")) +
labs(title = "SEIR Model Dynamics", x = "Time (days)", y = "Population Count") +
scale_color_manual(values = c("Susceptible" = "blue", "Exposed" = "orange", "Infectious" = "red", "Recovered" = "green")) +
theme_minimal() +
theme(legend.title = element_blank())Hepatitis E Virus (HEV) is a liver disease transmitted through contaminated water. It has a well-defined incubation period, making the SEIR model an excellent tool to understand HEV dynamics.
To adapt our SEIR model for HEV, we’ll use HEV-specific parameters and a modified incubation period.
# Parameters specific to HEV
hev_parameters <- c(beta = 0.0015, # Reduced transmission rate for HEV
sigma = 0.07, # Progression rate for HEV (approx. 2 weeks latent period)
gamma = 0.04) # Recovery rate for HEV (approx. 25 days infectious period)
# Solve the adapted SEIR model for HEV
hev_out <- ode(y = initial_state, times = times, func = seir_model, parms = hev_parameters)
# Convert output to data frame for plotting
hev_out <- as.data.frame(hev_out)ggplot(hev_out, aes(x = time)) +
geom_line(aes(y = S, color = "Susceptible")) +
geom_line(aes(y = E, color = "Exposed")) +
geom_line(aes(y = I, color = "Infectious")) +
geom_line(aes(y = R, color = "Recovered")) +
labs(title = "SEIR Model for Hepatitis E Virus", x = "Time (days)", y = "Population Count") +
scale_color_manual(values = c("Susceptible" = "blue", "Exposed" = "orange", "Infectious" = "red", "Recovered" = "green")) +
theme_minimal() +
theme(legend.title = element_blank())In this lesson, we explored the SEIR model with a focus on the exposed compartment and applied it to Hepatitis E Virus. Including an exposed compartment allows us to realistically model diseases with latent periods, like HEV.
The following team members contributed to this lesson:
This work is licensed under the Creative Commons Attribution Share Alike license.