← Iris

Susceptible 197
Infected 3
Recovered 0
Day 0
Agent simulation
Epidemic curve
R₀ = 4.00 Herd immunity 75%
β (infection) 0.40
γ (recovery) 0.10
Population 200
Initial infected 3

The SIR model

The SIR model was introduced by W. O. Kermack and A. G. McKendrick in their 1927 paper “A Contribution to the Mathematical Theory of Epidemics,” published in the Proceedings of the Royal Society. The idea is deceptively simple: divide a population of size N into three compartments. S counts the susceptibles — those who can catch the disease. I counts the infected — those who are currently sick and contagious. R counts the recovered — those who have been through the disease and are now immune (or dead, depending on the model). The differential equations are: dS/dt = −βSI/N, dI/dt = βSI/N − γI, dR/dt = γI. The parameter β captures the rate of disease-producing contacts per unit time, and γ is the rate of recovery (so 1/γ is the average duration of infection). The model makes strong simplifying assumptions — homogeneous mixing, permanent immunity, no births or deaths, no latent period — and yet it captures the essential qualitative shape of an epidemic: exponential growth, a peak determined by susceptible depletion, and a decline. Its power lies not in its realism but in its transparency. Every epidemic has the same skeleton, and SIR reveals it.

R₀ and herd immunity

The basic reproduction number R₀ is defined as the average number of secondary infections produced by a single infected individual in a fully susceptible population. In the SIR model, R₀ = β/γ. If R₀ < 1, each infected person infects fewer than one other on average, and the disease dies out. If R₀ > 1, the epidemic grows. The threshold theorem of epidemiology, derived by Kermack and McKendrick themselves, states that an epidemic can only take off when S/N > 1/R₀. This immediately gives the herd immunity threshold: if a fraction 1 − 1/R₀ of the population is immune (by vaccination or prior infection), the remaining susceptibles are too sparse for chains of transmission to sustain themselves. For measles (R₀ ≈ 12–18), herd immunity requires about 92–95% of the population to be immune. For influenza (R₀ ≈ 2–3), it is around 50–67%. But R₀ alone does not tell the whole story. It is an average, and averages can hide critical structure. Superspreading events, heterogeneous contact patterns, and spatial clustering all mean that the effective reproduction number can vary dramatically from person to person and place to place.

Stochastic vs. deterministic

The ODE version of SIR is deterministic: given the same initial conditions, you always get the same epidemic curve. The agent-based simulation above is stochastic: each run is different. This is not a deficiency — it is a feature. In reality, diseases spread through discrete, probabilistic encounters, not smooth differentials. The stochastic version captures phenomena that the deterministic model misses entirely. Extinction by chance: even when R₀ > 1, a small number of initial infections can die out before the epidemic takes off — the chain of transmission breaks by bad luck. The ODE model always predicts an epidemic when R₀ > 1; the stochastic model shows that sometimes nothing happens. Critical community size: in small populations, stochastic burnout is common. The disease runs out of susceptibles and vanishes before new ones are born. Measles requires a population of roughly 250,000–500,000 to persist endemically. Below that threshold, epidemics are intermittent and die between waves. Run the simulation with a small population and you will see this: some runs produce full epidemics, others fizzle. The ODE gives you the expected trajectory; the agent model gives you the distribution of possible ones.

Vaccination and containment

Vaccination works by moving individuals directly from S to R without passing through I. If you vaccinate enough people to reduce the susceptible fraction below 1/R₀, the effective reproduction number Reff = R₀ × S/N drops below 1, and chains of transmission cannot sustain themselves. This is herd immunity achieved by intervention rather than infection. The “Vaccinate” button above demonstrates this: click it, and 30% of the susceptible population is instantly immunized. If this pushes S/N below the herd immunity threshold, the epidemic collapses. Ring vaccination is a more targeted strategy: instead of vaccinating randomly, you vaccinate the contacts of known cases, building a firewall around each outbreak. This is how smallpox was eradicated — not by vaccinating everyone on Earth, but by finding cases and vaccinating around them. The strategy works because it exploits the network structure of transmission. You do not need to immunize the whole population; you need to cut the paths the disease would travel. Containment measures — quarantine, social distancing, contact tracing — all work by the same principle: reducing the effective contact rate, which reduces Reff below 1.

Beyond SIR

The SIR framework is the beginning, not the end. SEIR adds an Exposed compartment for the latent period between infection and infectiousness — critical for diseases like COVID-19, where presymptomatic transmission drives epidemics. SIS removes the recovered compartment entirely: individuals return to S after infection, modeling diseases like gonorrhea where there is no lasting immunity. SIRS allows immunity to wane over time, so R flows back to S at some rate — relevant for diseases like seasonal influenza, where antigenic drift erodes prior immunity. Network models replace the mean-field assumption of homogeneous mixing with explicit contact networks: who actually talks to whom, who lives with whom, who shares a bus. On a scale-free network (where a few individuals have vastly more contacts than most), the epidemic threshold can vanish entirely — any R₀ > 0 can produce an epidemic if the variance in contacts is high enough. Metapopulation models add spatial structure: cities connected by travel, each with its own local SIR dynamics, coupled by the movement of infected individuals. The 2009 H1N1 pandemic spread along airline routes, not geographic borders, and metapopulation models predicted its arrival timing with remarkable accuracy. Every extension trades simplicity for realism, but the core insight of SIR persists: epidemics are driven by the interaction between the rate of new infections and the depletion of the susceptible pool.