Basic stochastic simulation models - Amazon S3 · Basic stochastic simulation models Clinic on the...
Transcript of Basic stochastic simulation models - Amazon S3 · Basic stochastic simulation models Clinic on the...
000
Basic stochastic simulation models
Clinic on the Meaningful Modeling of Epidemiological Data, 2017
African Institute for Mathematical Sciences
Muizenberg, South Africa
Rebecca Borchering, PhD, MS
Postdoctoral Fellow
Biology Department & Emerging Pathogens Institute
University of Florida
Slide Set Citation: DOI: 10.6084/m9.figshare.5044624
The ICI3D Figshare Collection 1
000
Goals• Understand motivation for using stochastic models
• Understand two common approaches to stochastic simulation: discrete time vs. event-driven
• Be able to relate these models to the differential equation models we have studied
• Recognize potential benefits and limitations of these stochastic models
2
000
CONTINUOUS TIME
• Gillespie algorithm
DISCRETE TIME
• Chain binomial type models
(eg, Stochastic Reed-Frost models)STO
CH
AST
IC
CONTINUOUS TIME
• Stochastic differential equations
DISCRETE TIME
• Stochastic difference equations
DISCRETE TREATMENT OF INDIVIDUALS
Model taxonomyD
ETER
MIN
ISTI
C
CONTINUOUS TREATMENT OF INDIVIDUALS
(averages, proportions, or population densities)
CONTINUOUS TIME
• Ordinary differential equations
• Partial differential equations
DISCRETE TIME
• Difference equations
(eg, Reed-Frost type models)
3
000
Animal Rabies Cases in Tanzania
Data Credit: Hampson et al. 2009
Serengeti and Ngorongoro Districts
4
000
Why stochastic?
• Small populations, extinction
• Noisy data• imperfect observation
• small samples
• Environmental stochasticity• long term variation in external drivers
• changes in rates, including birth and death rates
• Demographic stochasticity• comes out of having discrete individuals
www.imagepermanenceinstitute.org
5
000
Population size -
Continuous Time Markov Chain (CTMC)- finite population size
- stochastic
Ordinary Differential Equation (ODE)- large (infinite) population size- deterministic 6
000
Reed-Frost (Chain Binomial)
• Fixed infectious period duration
• Generations of infectious individuals don’t overlap
• Define
probability of infection
infectious individuals (cases) at time t
susceptible individuals at time t
7
000
The Reed-Frost model
Infectious
Susceptible
Recovered
8
000
• Let
• So the probability of getting infected by any infectious individual is
• For each susceptible individual, at time t:
The Reed-Frost model
prob. not getting infected by a particular infectious individual
prob. not getting infected by any infectious individual
prob. of getting infected by any infectious individual
10
000
• The probability of getting infected by any infectious individual is
• The expected number of cases in the next time unit is
The Reed-Frost model
• Susceptible individuals in the next time unit
• Recovered individuals in the next time unit
11
000
The Reed-Frost model
12
000
• The full set of equations describing the deterministic population update is:
• If is the total population size, the basic reproductive number for this model is
The Reed-Frost model
13
000
• For each susceptible individual, at time t:
• Let
• So the probability of getting infected by any infectious individual is
Building stochastic R-F model
prob. not getting infected by a particular infectious individual
prob. not getting infected by any infectious individual
prob. of getting infected by any infectious individual
14
000
• For each susceptible individual, at time t:
Building stochastic R-F model
prob. not getting infected by a particular infectious individual
prob. of not getting infected by any infectious individual
15
000
The stochastic R-F modelPutting it all together:
prob. of x individuals getting infected by any infectious individual
number of ways to choose x individuals
prob. of individuals not getting infected by any infectious individual
16
000
The Reed-Frost model
Stochastic: Deterministic:
17
000
Chain binomial models• Chain binomial models can also be formulated based on the same
parameters we used in the ODE models and with overlapping generations
• Instantaneous hazard of infection for an individual susceptible individual is
• For a susceptible at time t, the probability of infection by time
is
• Similarly, for an infectious individual at time t, the probability of recovery by time is
18
000
Chain binomial models
The stochastic population update can then be described as
new infectious individuals
new recovered individualsrandom variables
19
000
Chain binomial models• For this model, if D is the average duration of infection, the basic
reproductive number is:
• Non-generation-based chain binomial models can be adapted to include many variations on the natural history of infection.
• Discrete-time simulation of chain binomials is far more computationally efficient than event-driven simulation in continuous time.
20
000
Chain binomial simulationwhile (I > 0 and time < MAXTIME)
Calculate transition probabilities
Determine number of transitions for each type
Update state variables
Update time
end
21
000
Another way to simulate stochastic epidemics…
event-driven simulation
22
000
Stochastic SIR dynamics
Small population
Susceptible
Infectious
Recovered
23
000
Stochastic SIR dynamics
Small population
Susceptible
Infectious
Recovered
24
000
Stochastic SIR dynamics
Small population
Susceptible
Infectious
Recovered
25
000
Stochastic SIR dynamics
Small population
Susceptible
Infectious
Recovered
26
000
Stochastic SIR dynamics
Small population
Susceptible
Infectious
Recovered
27
000
Exponential waiting times
waiting time distribution: distribution of times until an event occurs
time between events
0 2 4 6 8 10
0.0
0.5
1.0
1.5
Days since infection
Pro
ba
bili
ty d
en
sity rate
0.511.5
28
000
Summary: Gillespie algorithm
• finite, countable populations
• well-mixed contacts
• exponential waiting times (memory-less)
Assumptions:
29
000
Summary: Gillespie algorithm
• finite, countable populations
• well-mixed contacts
• exponential waiting times (memory-less)
Assumptions:
• noise (stochasticity) is introduced by the discrete nature of individuals
• event-driven simulation
• computationally slow• especially for large populations
Notes:
30
000
• What happened ?
• When did it happen?
Need to know
Two event types:
Transmission
Recovery
Susceptible to Infectious
Infectious to Recovered
31
000
Need to know• What happened ?
• When did it happen?
Two event types:
Transmission
Recovery
ODE analogue:
32
000
Need to know• What happened ? EventType
• When did it happen? EventTime
Two event types:
Transmission
Recovery
33
000
The Gillespie algorithmTwo event types:
Transmission
Recovery
Time to the next event:
Probability the event is type i: 34
000
Simulating the Gillespie modelwhile (I > 0 and time < MAXTIME)
Calculate rates
Determine time to next event
Determine event type
Update state variables
Update time
end
35
000
Break
36
000
Rabies example
?Maintenance population Target population
37
000
Types of transmissionSpillover infections
Within-population
Maintenance population Target population
Target population 38
000
R code example
SIR model with spillover
Associated file is linked from the schedule
39
000
R code example
• population size
• spillover rate
• transmission rate
• recovery rate
Try changing:
SIR model with spillover
Associated file is linked from the schedule
40
000
Sample output
41
000
Sub-critical or super-critical?Basic reproduction number for SIR model:
Sub-critical Super-critical
42
000
Jackal rabies application
Rhodes et al. (1998) "Rabies in Zimbabwe: reservoir dogs and the implications for disease control." Philosophical Transactions of the Royal Society B.
(rabies is sub-critical)
Question: how many additional infections are needed in order for rabies to be super-critical in the jackal population?
43
000
Summary• There are many sources of stochasticity including small
population size, imperfect observation of cases, and environmental variability
• The Reed-Frost model is a discrete time model, where the time step is based on the infectious period
• Chain binomial models can be thought of as a generalization of the stochastic Reed-Frost model with an arbitrary time step and infectious period duration
• Event-driven simulations where each event is modeled separately are intuitive, but can be computationally slow especially for large populations
44
000
This presentation is made available through a Creative Commons Attribution license. Details of the license and permitted uses are available at
http://creativecommons.org/licenses/by/3.0/
© 2012 International Clinics on Infectious Disease Dynamics and DataBorchering R, Pulliam JRCP. “Basic Stochastic Simulation Models” Clinic on the Meaningful Modeling of
Epidemiological Data. DOI: 10.6084/m9.figshare.5044624.For further information or modifiable slides please contact [email protected].
See the entire ICI3D Figshare Collection. DOI: 10.6084/m9.figshare.c.3788224.
000
000
000