Grid Epidemiology Demo

Outbreak simulator to explore herd effects.

Built for a computational modeling course in evolution and ecology, this browser-based simulation models local disease transmission on a 2D grid. One patient zero infects susceptible neighbors in a four-neighbor spread model, wave by wave, while the grid visualization and a time-series chart update in real time. Susceptible, infected, and vaccinated states are tracked per cell; vaccination is pre-assigned randomly before the outbreak begins.

The controls — grid size, vaccination rate, frame delay, pause, restart, and single-step advance — are designed for experimentation rather than passive observation. The single-step mode is particularly useful for tracing exactly how a specific outbreak propagates through a sparsely or densely vaccinated grid.

The most substantive tool is the vaccination sweep: at each coverage level from 0% to 90%, the simulation runs 12 independent replicates and plots the mean final infected fraction. Running replicates per level rather than a single trial smooths out stochastic variance — the same vaccination rate can produce very different outbreak sizes depending on where patient zero lands and how the random vaccination fell. The resulting curve isn’t a smooth slope: mean outbreak size holds high across low coverage, then collapses over a narrow band of vaccination rates. That sharp drop is the herd immunity threshold emerging from local transmission rules alone, with no global parameter dictating it — the same nonlinearity that makes a few percentage points of coverage the difference between containment and a full outbreak.