HomeArticlesSEIR Epidemic Model

The SEIR Model: How Epidemics Rise and Fall

Susceptible, Exposed, Infectious, Recovered — the compartments, the R0 threshold, and why herd immunity doesn't need everyone immune.

mysimulator teamUpdated June 2026≈ 8 min read▶ Open the simulation

From SIR to SEIR: adding the incubation period

The classic SIR model splits a population into three compartments — Susceptible, Infectious, Recovered — and moves people between them with two rates: a transmission rate β (susceptible meets infectious, becomes infectious) and a recovery rate γ (infectious becomes recovered). It is a good first model, but wrong for diseases with a meaningful incubation period, where a person is infected but not yet infectious. SEIR adds a fourth compartment, Exposed, and a rate σ (inverse of the average incubation period) that governs how fast an exposed person becomes infectious:

dS/dt = -beta*S*I/N
dE/dt =  beta*S*I/N - sigma*E
dI/dt =  sigma*E     - gamma*I
dR/dt =  gamma*I
live demo · particle contacts driving S to E to I to R● LIVE

On this site the compartments are not four numbers integrated as a system of ODEs — they are the state of individual moving particles. Each particle carries a compartment label, moves around the canvas, and transitions when a susceptible particle's position overlaps an infectious one (a stochastic, per-contact analogue of the β·S·I/N term) or when internal timers for incubation and recovery expire. Averaged over many particles the emergent curve reproduces the shapes the differential equations predict, but you additionally see the effect of space: clustering, local depletion of susceptibles, and superspreader-like bursts a well-mixed ODE model cannot show.

R0 and the threshold that decides everything

The single most important number in epidemiology is the basic reproduction number R0 — the expected number of secondary infections one infectious person causes in a fully susceptible population. For SEIR, R0 = β/γ. If R0 > 1, each infection produces more than one new infection on average and the epidemic grows exponentially at first; if R0 < 1, it dies out. R0 is not a fixed property of a pathogen — it depends on contact rates, so lockdowns, mask-wearing and school closures all work by pushing the effective reproduction number Rt below 1, not by changing the virus itself.

Herd immunity: why you don't need everyone immune

The herd immunity threshold is the fraction of the population that needs to be immune (via infection or vaccination) for Rt to drop below 1 even though the pathogen itself is unchanged. Because each infectious contact now has a chance to hit someone already immune, the threshold follows directly from R0:

herd immunity threshold  p_c = 1 - 1/R0

R0 = 2  =>  p_c = 50%     (roughly seasonal flu)
R0 = 6  =>  p_c ~ 83%     (roughly measles, pre-vaccine estimates)

Reaching this fraction does not make the disease vanish instantly; it makes each new chain of transmission statistically likely to fizzle out before it reaches many people, protecting even the unvaccinated minority indirectly. Quarantine acts on a different lever: instead of removing susceptibles from the pool (what vaccination does), it removes infectious contacts by lowering the effective β, and unlike vaccination it can be reversed the moment it is lifted — which is why quarantine-only strategies tend to produce a second wave once relaxed, and vaccination-based herd immunity does not.

Where the simple model breaks down

Real epidemics deviate from this in ways worth knowing before trusting a dashboard number. Immunity from infection or vaccination can wane, turning R back into S over time (an SEIRS variant). Contact networks are not homogeneous — a small number of superspreader contacts can dominate transmission in ways a single averaged β hides. And R0 estimates from early case data are notoriously sensitive to under-reporting and the serial interval assumed, which is why credible R0 estimates for the same pathogen sometimes vary by a factor of two between papers.

Frequently asked questions

What is the difference between R0 and the effective reproduction number Rt?

R0 is the reproduction number in a fully susceptible population with no interventions — a fixed reference number for a given pathogen and contact pattern. Rt is the real-time reproduction number, which falls as immunity builds up or interventions reduce contacts; an epidemic is shrinking whenever Rt is below 1, regardless of what R0 originally was.

Why does the epidemic curve peak and then fall even without a vaccine?

Because the susceptible pool shrinks as people get infected and recover. Once enough of the population is immune, each infectious person on average infects fewer than one new person (Rt < 1), so the epidemic peaks and declines on its own — the herd immunity threshold reached through infection rather than vaccination, at a much higher human cost.

Does quarantine work the same way as vaccination?

No. Vaccination permanently moves people from Susceptible to Recovered/immune. Quarantine only lowers the contact rate β while it is in force — it does not reduce the size of the susceptible pool, so lifting quarantine before enough immunity has built up (via infection or vaccination) typically lets the epidemic resume.

Try it live

Everything above runs in your browser — open Epidemic Dynamics and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Epidemic Dynamics simulation

What did you find?

Add reproduction steps (optional)