SIR Epidemic Model Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Overview

The SIR model is a classic, deterministic compartment model for infectious disease dynamics. It divides a closed population into three groups:

Given initial conditions and two rate parameters—β (infection/transmission rate) and γ (recovery/removal rate)—the model produces an “epidemic curve”: infections rise, peak, and then fall as susceptibility is depleted. This calculator simulates that curve numerically over time using a discrete time step.

What the inputs mean

Model equations (continuous time)

The standard SIR differential equations (Kermack–McKendrick) are:

dSdt = βSIN dIdt = βSINγI dRdt = γI

These equations assume that transmission is proportional to the product S·I (homogeneous mixing) and scaled by 1/N.

Key derived quantities

Discrete-time simulation (Euler method)

This calculator advances the model using a forward Euler discretization with time step Δt:

In general, smaller Δt reduces numerical error. If Δt is too large, Euler updates can overshoot and produce unrealistic values (e.g., negative S or I), especially when β is high or when the epidemic changes rapidly.

How to interpret results

To explore interventions conceptually, lowering β (reduced contact/transmission) or raising γ (faster recovery/isolation) reduces R₀ and tends to reduce the peak and total infections.

Worked example

Suppose:

Then:

If you run the simulation long enough, I(t) will rise from 1, reach a peak, and eventually fall as S(t) declines and Re(t) drops below 1. Try decreasing β to 0.15 (keeping γ = 0.1): R₀ becomes 1.5 and the peak should be smaller and later; decreasing β below 0.1 makes R₀ < 1 and I(t) typically shrinks from the start.

Parameter comparison (what changes when you adjust inputs)

Change Typical effect on the epidemic curve Why
Increase β Faster growth, higher and earlier peak; larger total infected More transmission per S–I contact increases incidence
Decrease β Slower growth, lower peak; may prevent a major outbreak Reduces R₀ and Re(t)
Increase γ Lower peak and shorter outbreak duration People leave I faster (shorter infectious period)
Increase I₀ Earlier visible outbreak; peak may occur sooner More initial infectious seed accelerates early dynamics
Decrease Δt More stable/accurate numerical trajectory (slower to compute) Reduces discretization error from Euler steps

Assumptions & limitations

Reference: Kermack, W.O. & McKendrick, A.G. (1927). “A Contribution to the Mathematical Theory of Epidemics.”

Enter parameters and simulate disease progression.

Embed this calculator

Copy and paste the HTML below to add the SIR Epidemic Model Calculator to your website.