Program 6.3 - SIR model with demographic stochasticity
An alternative formulation which allows noise to be incorported into epidemiological models is to use event-driven or demographic stochasticity. Demographic stochasticity is defined as fluctuations in population processes that arise from the random nature of events at the level of the individual. Therefore, even though the baseline probability associated with each event is fixed, individuals experience differing fates due to chance. Additionally, in contrast to the previous methods, the number of infectious, susceptible, and recovered individuals is now required to be an integer—we deal with whole numbers of people, animals, or other organisms. Events occur sequentially and at random, but with rates specified by the underlying equations; each event then causes an integer change to the population variables and the process is repeated.
For simplicity we first look at the SIS model where only two processes (infection and recovery) are possible:
For simplicity we first look at the SIS model where only two processes (infection and recovery) are possible:

Note that we are using numbers (X,Y,Z) throughout this chapter for greater clarity.
Parameters
β | is the transmission rate and incorporates the encounter rate between susceptible and infectious individuals together with the probability of transmission |
γ | is called the removal or recovery rate, though often we are more interested in its reciprocal (1/γ) which determines the average infectious period |
Y(0) | is the initial number of infectious individuals |
N | is the population size -- assumed to be constant |
All rates are specified in days.
Requirements.
All parameters must be positive. Remember, Y and N both refer to numbers.
Files
MATLAB Code, Python Program, R Code.