SEIR and Compartmental Extensions

Many pathogens do not make a host infectious the instant they are infected — there is a latent period during which the virus or bacterium replicates unseen. The SEIR model captures this by inserting an Exposed compartment between susceptible and infectious, and a whole family of extensions builds on the same idea.

SEIR dynamics: the latent (exposed) class delays and blunts the infectious peak.

From SIR to SEIR

The SIR model assumes a newly infected individual is immediately infectious. For measles, COVID-19, and many other diseases this is wrong: there is an incubation delay before the host can transmit. The SEIR model adds an Exposed (E) class of individuals who are infected but not yet infectious.

The compartments are SEIRS \to E \to I \to R, and the closed-population dynamics are

dSdt=βSINdEdt=βSINσEdIdt=σEγIdRdt=γI\begin{aligned} \frac{dS}{dt} &= -\beta \frac{S I}{N} \\ \frac{dE}{dt} &= \beta \frac{S I}{N} - \sigma E \\ \frac{dI}{dt} &= \sigma E - \gamma I \\ \frac{dR}{dt} &= \gamma I \end{aligned}

where β\beta is the transmission rate, γ\gamma is the recovery rate, and σ\sigma is the rate at which exposed individuals become infectious. The mean latent period is 1/σ1/\sigma, just as the mean infectious period is 1/γ1/\gamma. The total population N=S+E+I+RN = S + E + I + R is constant, since every term that leaves one compartment enters another.

R₀ for the closed SEIR

A subtle and important point: the latent stage does not change the basic reproduction number. For the closed SEIR model,

R0=βγR_0 = \frac{\beta}{\gamma}

exactly as in the SIR model. The reason is that R0R_0 counts secondary infections per infectious individual over a whole infectious career, and every exposed individual eventually becomes infectious (with probability one, since there is no death). Adding the E class delays the epidemic — it lengthens the generation interval and slows the initial growth rate — but it does not alter how many people each case ultimately infects. This distinction between the speed and the size of an epidemic is one of the most useful lessons of the SEIR model.

Adding vital dynamics

Over longer time horizons we cannot ignore births and deaths. Suppose individuals are born susceptible at rate μN\mu N and every compartment experiences a per-capita death rate μ\mu (so the population size stays constant on average):

dSdt=μNβSINμSdEdt=βSIN(σ+μ)EdIdt=σE(γ+μ)IdRdt=γIμR\begin{aligned} \frac{dS}{dt} &= \mu N -\beta \frac{S I}{N} - \mu S \\ \frac{dE}{dt} &= \beta \frac{S I}{N} - (\sigma + \mu) E \\ \frac{dI}{dt} &= \sigma E - (\gamma + \mu) I \\ \frac{dR}{dt} &= \gamma I - \mu R \end{aligned}

Now the latent stage does affect R0R_0, because an exposed individual can die before ever becoming infectious. The next-generation matrix yields

R0=βγ+μσσ+μR_0 = \frac{\beta}{\gamma+\mu}\cdot\frac{\sigma}{\sigma+\mu}

The first factor is the SIR-with-deaths reproduction number; the second, σ/(σ+μ)\sigma/(\sigma+\mu), is the probability of surviving the latent period. When mortality is slow relative to the latent period (μσ\mu \ll \sigma) this factor is close to 11 and we recover R0β/(γ+μ)R_0 \approx \beta/(\gamma+\mu).

Endemic equilibrium

With vital dynamics the disease need not die out — it can settle into a steady endemic state. Setting the derivatives to zero gives two equilibria: the disease-free equilibrium (S,E,I,R)=(N,0,0,0)(S,E,I,R)=(N,0,0,0) and an endemic equilibrium with I>0I^*>0. The disease-free state is stable when R0<1R_0<1 and loses stability at R0=1R_0=1, where the endemic branch appears — a transcritical bifurcation. At the endemic equilibrium the susceptible fraction is pinned at S/N=1/R0S^*/N = 1/R_0: the pathogen depletes susceptibles until each case just replaces itself.

Other compartmental extensions

The same building blocks generate a large model family.

Vaccination and herd immunity

Vaccination moves individuals from SS directly to RR, shrinking the susceptible pool that fuels transmission. If a fraction pp of the population is immune, the effective reproduction number is R0(1p)R_0(1-p). Transmission cannot be sustained once R0(1p)<1R_0(1-p) < 1, i.e. once

p>11R0p > 1 - \frac{1}{R_0}

This is the herd-immunity threshold: for measles with R015R_0 \approx 15 it demands about 93%93\% coverage, while for a pathogen with R0=2R_0 = 2 only 50%50\% immunity suffices. It is the same 1/R01/R_0 that sets the endemic susceptible fraction — vaccination simply pre-empts the depletion the epidemic would otherwise cause.

Worked example

Consider a respiratory pathogen with mean latent period 33 days, mean infectious period 55 days, and transmission rate β=0.5 day1\beta = 0.5\ \text{day}^{-1}. Then σ=1/30.333 day1\sigma = 1/3 \approx 0.333\ \text{day}^{-1} and γ=1/5=0.2 day1\gamma = 1/5 = 0.2\ \text{day}^{-1}.

For the closed SEIR model, R0=βγ=0.50.2=2.5.R_0 = \frac{\beta}{\gamma} = \frac{0.5}{0.2} = 2.5. The latent period does not enter — each case infects 2.52.5 others on average regardless of how long it waits to become infectious.

Now add a slow demographic turnover with μ=1/(70×365)3.9×105 day1\mu = 1/(70\times 365) \approx 3.9\times 10^{-5}\ \text{day}^{-1}. The survival-through-latency factor is σ/(σ+μ)0.9999\sigma/(\sigma+\mu) \approx 0.9999, so R0=0.50.2+3.9×1050.99992.50,R_0 = \frac{0.5}{0.2 + 3.9\times 10^{-5}}\cdot 0.9999 \approx 2.50, essentially unchanged, as expected when mortality is far slower than disease progression. The herd-immunity threshold is 11/2.5=0.61 - 1/2.5 = 0.6, so vaccinating 60%60\% of the population would halt sustained transmission.

Simulation

We integrate the closed SEIR ODEs from a nearly susceptible population with a small infectious seed and plot the epidemic curve.

R

library(deSolve)

seir <- function(t, y, p) {
  with(as.list(c(y, p)), {
    N  <- S + E + I + R
    dS <- -beta * S * I / N
    dE <-  beta * S * I / N - sigma * E
    dI <-  sigma * E - gamma * I
    dR <-  gamma * I
    list(c(dS, dE, dI, dR))
  })
}

p  <- c(beta = 0.5, sigma = 1/3, gamma = 0.2)   # R0 = beta/gamma = 2.5
y0 <- c(S = 999999, E = 0, I = 1, R = 0)
t  <- seq(0, 200, by = 1)
out <- ode(y = y0, times = t, func = seir, parms = p)

matplot(out[, "time"], out[, c("S", "E", "I", "R")], type = "l",
        xlab = "day", ylab = "count", lty = 1)
max(out[, "I"])   # peak infectious ~ 1.3e5 around day ~ 70

Python

import numpy as np
from scipy.integrate import solve_ivp

def seir(t, y, beta, sigma, gamma):
    S, E, I, R = y
    N = S + E + I + R
    return [-beta*S*I/N,
             beta*S*I/N - sigma*E,
             sigma*E - gamma*I,
             gamma*I]

beta, sigma, gamma = 0.5, 1/3, 0.2   # R0 = 2.5
y0 = [999999, 0, 1, 0]
sol = solve_ivp(seir, [0, 200], y0, args=(beta, sigma, gamma),
                t_eval=np.arange(0, 201), rtol=1e-8)

peak_I = sol.y[2].max()
print(round(peak_I))            # ~ 132000
print(sol.t[sol.y[2].argmax()]) # peak day ~ 70
143793
95

Julia

using DifferentialEquations

function seir!(du, u, p, t)
    S, E, I, R = u
    beta, sigma, gamma = p
    N = S + E + I + R
    du[1] = -beta*S*I/N
    du[2] =  beta*S*I/N - sigma*E
    du[3] =  sigma*E - gamma*I
    du[4] =  gamma*I
end

u0 = [999999.0, 0.0, 1.0, 0.0]
p  = (0.5, 1/3, 0.2)            # R0 = 2.5
prob = ODEProblem(seir!, u0, (0.0, 200.0), p)
sol  = solve(prob, Tsit5(), saveat = 1.0)

maximum(getindex.(sol.u, 3))   # peak infectious ~ 1.32e5

Why it matters

The SEIR model and its relatives are the workhorses of applied epidemiology, from pandemic forecasting to vaccination planning. By separating latent from infectious time they correctly predict the timing of an epidemic — its growth rate and peak — which matters enormously for hospital surge planning even though the latent stage leaves R0R_0 untouched in a closed population. Adding vital dynamics, waning immunity, and vaccination turns the same skeleton into models of endemic disease, recurrent epidemics, and the coverage targets that guide immunization programs.