This app lets you explore a stochastic SIR model. Read about the model in the “Model” tab. Then do the tasks described in the “What to do” tab.
This model tracks susceptibles, infected/infectious and recovered hosts. The following compartments are included:
The included processes/mechanisms are the following:
The flow diagram for the model implemented in this app is:
Flow diagram for this model.
The deterministic model implemented as set of differential equations is given by the following equations:
\[\dot S = m - bSI - nS\] \[\dot I = bSI - gI - nI\] \[\dot R = gI - nR\]
This is almost the same model as the basic SIR model from the introductory app, with the only difference that this model also allows natural births and deaths. In this app, you can run the basic SIR model together with the stochastic one.
The main model we are focused on here is a stochastic implementation of the variables and processes described above. This model is not an ordinary differential equation model. It is instead its stochastic equivalent. We can specify the model by writing down every possible transition/event/reaction that can occur and their propensities (the propensity multiplied with the time step gives the probability that a given event/transition occurs). For our model these are the following:
Event type | Transitions | Propensity |
---|---|---|
Infection | S => S-1, I => I+1 | bSI |
Recovery | I => I-1, R => R+1 | gI |
Births | S => S+1 | m |
Death of susceptible | S => S-1 | nS |
Death of infected | I => I-1 | nI |
Death of recovered | R => R-1 | nR |
This simulation (as well as some of the others) involves using random numbers to introduce stochasticity/uncertainty/noise into the model. This leads to a model that usually more closely reflects the underlying real system. However, in science, we want to be as reproducible as possible. Fortunately, random numbers on a computer are not completely random, but can be reproduced. In practice, this is done by specifying a random number seed, in essence a starting position for the algorithm to produce pseudo-random numbers. As long as the seed is the same, the code should produce the same pseudo-random numbers each time, thus ensuring reproducibility.
The tasks below are described in a way that assumes everything is in units of DAYS (rate parameters, therefore, have units of inverse days). If any quantity is not given in those units, you need to convert it first (e.g. if it says a week, you need to convert it to 7 days).
Some of the simulations might take a few seconds to run. Be patient.
simulate_sirdemographic_ode, simulate_sirdemographic_stochastic
. You can call them directly, without going through the shiny app. Use the help()
command for more information on how to use the functions directly. If you go that route, you need to use the results returned from this function and produce useful output (such as a plot) yourself.vignette('DSAIDE')
into the R console.Black, F L. 1966. “Measles Endemicity in Insular Populations: Critical Community Size and Its Evolutionary Implication.” Journal of Theoretical Biology 11 (2): 207–11.
Keeling, Matt J, and Pejman Rohani. 2008. Modeling Infectious Diseases in Humans and Animals. Princeton University Press.
Keeling, M J. 1997. “Modelling the Persistence of Measles.” Trends in Microbiology 5 (12): 513–18. https://doi.org/10.1016/S0966-842X(97)01147-5.
Lloyd-Smith, James O, Paul C Cross, Cheryl J Briggs, Matt Daugherty, Wayne M Getz, John Latto, Maria S Sanchez, Adam B Smith, and Andrea Swei. 2005. “Should We Expect Population Thresholds for Wildlife Disease?” Trends in Ecology & Evolution 20 (9): 511–19. https://doi.org/10.1016/j.tree.2005.07.004.