Stochastic SIR Epidemic — Gillespie Algorithm
Exact stochastic simulation; fluctuations visible vs ODE mean field; multiple realizations
Population N:
200
R₀ (basic reproduction):
2.50
Recovery rate γ:
0.20
Realizations:
5
New Realization
Reset All
β = R₀·γ (infection rate)
Gillespie: next event time
τ = -ln(u)/Λ, Λ = βSI/N + γI
ODE: dS/dt=-βSI/N
SIR peak: I_max ~ N(1-1/R₀-ln(R₀)/R₀)
Herd immunity: p_c = 1-1/R₀