SIR Epidemic Model: Simulate Disease Spread

simulator beginner ~8 min
Loading simulation...
R₀ = 3.0 — epidemic spreads rapidly

With β=0.3 and γ=0.1, R₀=3.0. The epidemic peaks around day 45 with roughly 30% of the population infected simultaneously. Nearly 95% will eventually be infected.

Formula

dS/dt = −β·S·I/N
dI/dt = β·S·I/N − γ·I
dR/dt = γ·I
R₀ = β/γ

The Mathematics of Pandemics

In 1927, Kermack and McKendrick published a paper that would become the foundation of mathematical epidemiology. Their SIR model — dividing populations into Susceptible, Infected, and Recovered — elegantly captures the essential dynamics of epidemic spread with just two parameters and three differential equations. Nearly a century later, this same framework guided the response to COVID-19.

The Epidemic Curve

Every epidemic follows a characteristic arc: slow exponential growth, rapid acceleration, a peak when enough people have recovered to slow transmission, and then decline. The shape of this curve — its height, width, and timing — is entirely determined by R₀ and the initial conditions. This simulator lets you watch the curve form in real time as the disease spreads through the population.

R₀: The Magic Number

The basic reproduction number R₀ = β/γ is perhaps the most important single number in epidemiology. It tells you whether an epidemic will grow (R₀ > 1) or die out (R₀ < 1). Reducing R₀ below 1 is the goal of every intervention: vaccines reduce the susceptible pool, social distancing reduces β, and treatment reduces the infectious period (increases γ).

From Simple Model to Complex Reality

The SIR model is deliberately simple — it ignores age structure, spatial spread, behavioral changes, and many other factors. But this simplicity is a strength: it reveals the fundamental dynamics that more complex models build upon. Understanding SIR is the first step toward understanding SEIR, network models, agent-based simulations, and the full toolkit of modern computational epidemiology.

FAQ

What is the SIR model?

The SIR model divides a population into three compartments: Susceptible (S), Infected (I), and Recovered (R). People flow from S to I when they catch the disease (at rate β·S·I/N), and from I to R when they recover (at rate γ·I). It is the foundational model in mathematical epidemiology.

What does R₀ mean and why is it important?

R₀ (basic reproduction number) is the average number of new infections caused by one infected person in a fully susceptible population. If R₀ > 1, the epidemic grows exponentially. If R₀ < 1, it dies out. COVID-19 had R₀ ≈ 2.5–3.5, measles ≈ 12–18.

What does it mean to flatten the curve?

Flattening the curve means reducing β (through social distancing, masks, lockdowns) to lower the peak number of simultaneously infected people. The total infections may not change much, but spreading them over a longer period prevents health systems from being overwhelmed.

What are the limitations of the SIR model?

The basic SIR model assumes homogeneous mixing (everyone contacts everyone equally), permanent immunity after recovery, no births or deaths, and no latent period. Extensions like SEIR (adding Exposed), SIRS (waning immunity), and network models address these limitations.

Sources

Embed

<iframe src="https://homo-deus.com/lab/population-dynamics/sir-epidemic/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub