Stochastic SIS Epidemic — Gillespie Algorithm

Exact stochastic simulation of susceptible-infected-susceptible dynamics

The Gillespie algorithm generates exact trajectories of the stochastic SIS model. Infection rate beta = R0*gamma/N per S-I pair; recovery rate gamma per infected. When R0 > 1, the deterministic endemic state is I* = N(1-1/R0), but stochastic fluctuations cause extinction at small N. Multiple runs shown simultaneously to display ensemble variance.