AN INTRODUCTION TO STOCHASTIC EPIDEMICMODELS-PART I
Linda J. S. AllenDepartment of Mathematics and Statistics
Texas Tech UniversityLubbock, Texas U.S.A.
2008 Summer School onMathematical Modeling of Infectious Diseases
University of AlbertaMay 1-11, 2008
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Outline of Presentation-PART I
I. What is a Stochastic Model and What is the Difference Between aDeterministic and Stochastic Model?
II. Some Stochastic Models are Illustrated Through Study of an SIS EpidemicModel.
(a) Discrete Time Markov Chain – DTMC
(b) Continuous Time Markov Chain – CTMC
(c) Diffusion Process and Stochastic Differential Equations – SDE
III. Some Differences Between the Stochastic SIS and SIR Epidemic Models.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
I. What is a Stochastic Model?
A stochastic model is formulated in terms of a stochastic process.
A stochastic process is a collection of random variables
{Xt(s)|t ∈ T, s ∈ S},
where T is the index set and S is a common sample space. The index set oftenrepresents time, such as
T = {0, 1, 2, . . .} or T = [0,∞)
Time can be discrete or continuous.
The study of stochastic processes is based on probability theory.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
How do Stochastic Epidemic Models Differ fromDeterministic Epidemic Models?
• A deterministic model is often formulated in terms of a system ofdifferential equations or difference equations.
• A stochastic model is formulated as a stochastic process with a collectionof random variables.
• A solution of a deterministic model is a function of time or space and isgenerally uniquely dependent on the initial data.
• A solution of a stochastic model is a probability distribution for each ofthe random variables. One sample path over time or space is one realizationfrom this distribution.
• Stochastic models are often used to show the variability inherent dueto the demographics or environment variablility are particularly important whenquantities in the processes are small- small population size or initial number ofinfectives.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Following Graphs Illustrate the Dynamics of aDeterministic versus a Stochastic Epidemic Model
0 500 1000 1500 20000
5
10
15
20
25
30
35
Time Steps
Num
ber
of In
fect
ives
, I(t
)
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Whether the Random Variables Associated with TheStochastic Process are Discrete or Continuous Distinguishes
Some of the Different Types of Stochastic Models.
A random variable X(t) of a stochastic process assigns a real value to eachoutcome A ⊂ S in the sample space and a probability,
Prob{X(t) ∈ A} ∈ [0, 1].
The values of the random variable constitute the state space, X(t;S). Forexample, the number of cases associated with a disease may have the followingdiscrete or continuous set of values for its state space:
{0, 1, 2, . . .} or [0, N ].
The state space can be discrete or continuous and correspondingly, therandom variable is discrete or continuous. For simplicity, the sample spacenotation is suppressed and X(t) is used to denote a random variable indexedby time t. The stochastic process is completely defined when the set of randomvariables {X(t)} are related by a set of rules.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
We will Study Stochastic Processes that have the MarkovProperty.
A stochastic process with the Markov property is one where the future stateof the process depends only on the current state, and not on the past. That is,for a discrete-time stochastic process, a d
Prob{X(t + ∆t)|X(t),X(t − ∆t), . . . , X(0)} = Prob{X(t + ∆t)|X(t)}.
At a fixed time t, each random variable X(t) has an associated probabilitydistribution.
Discrete: Prob{X(t) = i} = pi(t), i ∈ {0, 1, 2 . . .}
Continuous: Prob{X(t) ∈ [a, b]} =∫ b
ap(x, t)dx
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Choice of Discrete or Continuous Random Variableswith a Discrete or Continuous Index Set Defines the Type
of Stochastic Model.
Discrete Time Markov Chain (DTMC): t ∈ {0, ∆t, 2∆t, . . .} X(t) is a discreterandom variable.
X(t) ∈ {0, 1, 2, . . . , N}The term chain implies that the random variable is discrete.
Continuous Time Markov Chain (CTMC): t ∈ [0,∞), X(t) is a discreterandom variable.
Xt ∈ {0, 1, 2, . . . , N}
Diffusion Process, Stochastic Differential Equation (SDE): t ∈ [0,∞), X(t) isa continuous random variable.
X(t) ∈ [0, N ]
L.J.S. Allen, TTU Stochastic Epidemic Models - I
II. Before we Formulate the Stochastic SIS EpidemicModels, we Review the Dynamics of the Deterministic SIS
Epidemic Model.
Deterministic SIS:
S I
dS
dt= − β
NSI + (b + γ)I
dI
dt=
β
NSI − (b + γ)I
where β > 0, γ > 0, N > 0 and b ≥ 0, S(t) + I(t) = N .
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Dynamics of the Deterministic SIS Epidemic ModelDepend on the Basic Reproduction Number.
The parameter values represent
β = transmission rate
b = birth rate = death rate
γ = recovery rate
N = total population size = constant.
Basic Reproduction Number:
R0 =β
b + γ
If R0 ≤ 1, then limt→∞ I(t) = 0.
If R0 > 1, then limt→∞ I(t) = N(
1 − 1R0
)
.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
We will Formulate the Three Types of Stochastic SISEpidemic Models by Defining Relationships Among the
Random Variables Assuming the Markov Property Holds.
S(t) = random variable for the number of susceptible individuals.
I(t) = random variable for the number of infected individuals.
S(t) + I(t) = N = maximum population size.
Discrete Time Markov Chain (DTMC): t ∈ {0, ∆t, 2∆t, . . .}, I(t) is a discreterandom variable,
I(t) ∈ {0, 1, 2, . . . , N}
Continuous Time Markov Chain (CTMC): t ∈ [0,∞), I(t) is a discrete randomvariable.
I(t) ∈ {0, 1, 2, . . . , N}
Diffusion Process, SDEs: t ∈ [0,∞), I(t) is a continuous random variable.
I(t) ∈ [0, N ]
L.J.S. Allen, TTU Stochastic Epidemic Models - I
First, We Formulate a DTMC SIS Epidemic Model.
Let I(t) denote the discrete random variable for the number of infected (andinfectious) individuals with associated probability function
pi(t) = Prob{I(t) = i}
where i = 0, 1, 2, . . . , N is the total number infected at time t. The probabilitydistribution is
p(t) = (p0(t), p1(t), . . . , pN(t))T
for t = 0, ∆t, 2∆t, . . . . Now we relate the random variables {I(t)} indexed bytime t by defining the probability of a transition from state i to state j, i → j,in time ∆t as
pji(∆t) = Prob{I(t + ∆t) = j|I(t) = i}.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Assume that ∆t is Sufficiently Small, Such that the Numberof Infectives Changes by at Most One in Time ∆t.
That is,i → i + 1, i → i − 1 or i → i.
Either there is a new infection, birth, death, or a recovery. Therefore, thetransition probabilities are
pji(∆t) =
βi(N − i)/N∆t = b(i)∆t, j = i + 1(b + γ)i∆t = d(i)∆t, j = i − 11 − [βi(N − i)/N + (b + γ)i]∆t =
1 − [b(i) + d(i)]∆t, j = i0, j 6= i + 1, i, i − 1,
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Probability Distribution Associated with the EpidemicProcess Over Time is Found by Repeated Multiplication of
the Transition Matrix.
Matrix P (∆t) = (pji(∆t)) is known as the transition matrix:
p(t + ∆t) = P (∆t)p(t),
where p(t) = (p0(t), . . . , pN(t))T is the probability distribution and P (∆t) is
1 d(1)∆t 0 · · · 00 1 − [b(1) + d(1)]∆t d(2)∆t · · · 00 b(1)∆t 1 − [b(2) + d(2)]∆t · · · 00 0 b(2)∆t · · · 0... ... ... ... ...0 0 0 · · · d(N)∆t0 0 0 · · · 1 − d(N)∆t
.
Matrix P (∆t) is stochastic, the column sums equal one.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Stochastic Process for the DTMC SIS Model is knownas a Finite State Markov Chain with the Following
Properties.
• The stochastic process {I(t)} for t ∈ {0, ∆t, 2∆t, . . .} is time-homogeneous (transition probabilities do not depend on time) and has theMarkov property.
• The probability of no infections p0 is an absorbing state.
0 1 2 N
• For any initial distribution p(0) = (p0(0), . . . , pN(0))T , zero through atotal of N infections
limt→∞
p(t) = (1, 0, . . . , 0)T limt→∞
p0(t) = 1.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Three Sample Paths of the DTMC SIS Model areCompared to the Solution of the Deterministic Model.
A sample path or stochastic realization of a stochastic process {I(t)} fort ∈ {0, ∆t, 2∆t, . . .} is an assignment of a possible value to I(t) for each valueof t.
R0 = 2.
0 5 10 15 20 250
10
20
30
40
50
60
70
Time
Num
ber
of In
fect
ives
∆t = 0.01, N = 100, β = 1, b = 0.25, γ = 0.25, I(0) = 2, and p2(0) = 1.The
MATLAB program is in the Appendix.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Probability Distribution p(t) for the Number of InfectedIndividuals in the DTMC SIS Model can be Approximated.
0
50
100
0
1000
2000
0
0.25
0.5
0.75
1
StateTime, n
Pro
babi
lity
Probability distribution for the DTMC SIS model, ∆t = 0.01, N = 100, β = 1, b = 0.25,
γ = 0.25, R0 = 2, I(0) = 2 and p2(0) = 1. MATLAB program is in the Appendix.
Note: Asymptotically, limt→∞ p0(t) = 1, the epidemic ends with probabilityone. But it may take a long time before p0 ≈ 1, if N and I(0) are large. In thisexample,
p0(t) ≈
„
1
R0
«I(0)
=
„
1
2
«2
=1
4.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Next, We Formulate a CTMC SIS Model.
This type of model is most often used to study stochastic epidemic processes,time is continuous, but the random variable for number of infected individualsis discrete. The discrete random variable I(t), t ∈ [0,∞) has an associatedprobability function
pi(t) = Prob{I(t) = i}
The probability of a transition for small ∆t satisfies
pji(∆t) =
βi(N − i)/N∆t + o(∆t) = b(i)∆t + o(∆t), j = i + 1(b + γ)i∆t + o(∆t) = d(i)∆t + o(∆t), j = i − 11 − [βi(N − i)/N + (b + γ)i]∆t + o(∆t)
= 1 − [b(i) + d(i)]∆t + o(∆t), j = io(∆t), otherwise,
where o(∆t) → 0 as ∆t → 0.
i → i + 1, i → i − 1, or i → i.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
A System of Differential Equations for the Probabilities Canbe Derived Based on the Transition Probabilities.
For small ∆t,
pi(t + ∆t) = pi−1(t)[b(i − 1)∆t] + pi+1(t)[d(i + 1)∆t]
pi(t)[1 − (b(i) + d(i))∆t] + o(∆t)
Subtracting pi(t), dividing by ∆t, and letting ∆t → 0,
dpi
dt= pi−1b(i − 1) + pi+1d(i + 1) − pi[b(i) + d(i)]
dp0
dt= p1d(1)
for i = 1, 2, . . . , N, where
b(i) = βi(N − i)/N, d(i) = (b + γ)i.
These differential equations are known as the forward Kolmogorov differentialequations.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Epidemic Process is Captured by a System ofDifferential Equations Expressed in Matrix Form.
In matrix notation,
dp
dt= Qp,
where p(t) = (p0(t), . . . , pN(t))T and Q is known as the generator matrix:
Q =
0
B
B
B
B
B
B
B
B
B
@
0 d(1) 0 · · · 0
0 −[b(1) + d(1)] d(2) · · · 0
0 b(1) −[b(2) + d(2)] · · · 0
0 0 b(2) · · · 0... ... ... ... ...
0 0 0 · · · d(N)
0 0 0 · · · −d(N)
1
C
C
C
C
C
C
C
C
C
A
.
b(i) = βi(N − i)/N and d(i) = (b + γ)i
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The DTMC Transition Matrix and CTMC DifferentialEquations are Closely Related when ∆t is Small.
In the DTMC Model,p(t + ∆t) = P (∆t)p(t),
where P (∆t) is the transition matrix. Letting ∆t → 0, we obtain theKolmogorov differential equations for the CTMC model,
p(t + ∆t) − p(t)
∆t=
P (∆t) − I
∆tp(t)
dp
dt= Qp
where
Q = lim∆t→0
P (∆t) − I
∆t.
The Discrete-Time Process can be used to Approximate the Continuous-Time Process.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Because of the Markov Property, the Inter-Event Time in aCTMC Model Has an Exponential Distribution.
The exponential distribution has what is known as the memoryless property.Let I(t) = n and Tn denote the inter-event time, a continuous random variablefor the time to the next event. Take the sum of all the probabilities of allpossible events where there is a change in state, i → i + 1, i → i − 1:
∞∑
j=0,j 6=n
pjn(∆t) = a(n)∆t + o(∆t)
andpnn(∆t) = 1 − a(n)∆t + o(∆t).
Then the interevent time has an exponential distribution with parameter a(n),
Tn ∼ E(a(n))
Prob{Tn ≤ t} = 1 − exp(−a(n)t).
L.J.S. Allen, TTU Stochastic Epidemic Models - I
For the SIS Epidemic Model, with I(t) = n,
∞∑
j=0,j 6=n
pjn(∆t) = [b(n) + d(n)]∆t + o(∆t)
= [βn(N − n)/N + (b + γ)n]∆t + o(∆t)
a(n) =β
Nn(N − n) + (b + γ)n
L.J.S. Allen, TTU Stochastic Epidemic Models - I
To Numerically Simulate the Inter-Event Time in a CTMCModel, We Use a Uniform Random Variable.
The inter-event time, waiting time until an event occurs, can be numericallycomputed using a uniform random variable and the cumulative distribution forTn. Let U be uniform random variable on [0, 1] and Fn(t) the cumulativedistribution for Tn
Fn(t) = Prob{Tn ≤ t} = 1 − exp(a(n)t).
Then
Prob{F−1n (U) ≤ t} = Prob{Fn(F
−1n (U)) ≤ Fn(t)}
= Prob{U ≤ Fn(t)}
= Fn(t)
The inter-event time Tn, given I(t) = n satisfies
Tn = F−1n (U) = −ln(1 − U)
a(n)= −ln(U)
a(n).
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Three Sample Paths of the CTMC SIS Model areCompared to the Deterministic Solution.
R0 = 2
0 5 10 15 20 250
10
20
30
40
50
60
70
80
Time
Num
ber
of In
fect
ives
b = 0.25, γ = 0.25, β = 1, N = 100, I(0) = 2, R0 = 2.
For ∆t small, the dynamics of the DTMC and the CTMC Models are Similar.The DTMC model can be used as an approximation for the CTMC model.MATLAB program is in the Appendix.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Next, We Formulate the Third Type of Stochastic Model, aSDE Model.
The number of infectives, I(t), is continuous random variable and the time,t ∈ [0,∞), is also continuous. The random variable I(t) has an associatedprobability density function (pdf), p(x, t),
Prob{I(t) ∈ [a, b]} =
∫ b
a
p(x, t)dx.
We can derive a system of differential equations satisfied by the pdf. This systemof equations is also known as the forward Kolmogorov differential equations:
∂p
∂t= −∂ {[βx(N − x)/N − (b + γ)x]p}
∂x
+1
2
∂2 {[βx(N − x)/N + (b + γ)x]p}∂x2
,
x ∈ [0, N ], t ∈ [0,∞). The first term is known as the drift and second termdiffusion.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Stochastic Differential Equation (SDE) Depends on theDrift and Diffusion Terms.
The Stochastic Differential Equation (SDE) follows directly from the differentialequations,
dI
dt=
β
NI(N − I) − (b + γ)I +
r
β
NI(N − I) + (b + γ)I
dW
dt,
where W (t) is a Wiener process (white noise), normally distributed, with meanzero and variance t:
W (t) ∼ Normal(0, t), W (t + ∆t) − W (t) ∼ Normal(0, ∆t).
Sample paths for a Wiener process are continuous but not differentiable.
0 0.2 0.4 0.6 0.8 1-1.5
-1
-0.5
0
0.5
1
Time
W(t
)
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The SDE Depends on Relationship Between Births andDeaths and Drift and Diffusion
Let b(I) =births (new infection or birth) and d(I) =deaths(recovery or death). Then the probability density p(x, t), where
Prob{I(t) ∈ [a, b]} =∫ b
ap(x, t)dx satisfies the differential equation
∂p(x, t)
∂t= −∂([b(x) − d(x)]p(x, t))
∂x+
1
2
∂2([b(x) + d(x)]p(x, t))
∂x2
and the stochastic differential equation (SDE) satisfies
dI
dt= b(I) − d(I) +
√
b(I) + d(I)dW
dt= drift + diffusion
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The Drift and Diffusion Terms Determine the Change inNumber of Infections Over Time
SDE:dI
dt= b(I) − d(I) +
√
b(I) + d(I)dW
dt
∆I(t) is approximately normally distributed with mean b(I) − d(I)]∆t andvariance, b(I) + d(I)]∆t :
∆I(t) = I(t + ∆t) − I(t) ∼ Normal([b(I) − d(I)]∆t, [b(I) + d(I)]∆t).
The Wiener process ∆W (t) (white noise) is normally distributed with mean0 and variance ∆t:
∆W (t) = W (t + ∆t) − W (t) =√
∆t η ∼ Normal(0, ∆t).
L.J.S. Allen, TTU Stochastic Epidemic Models - I
In General, the SDE is Expressed in Terms of theParameters for Recovery, Transmission and Birth.
SDE:
dI
dt=
β
NI(N − I) − (b + γ)I +
√
β
NI(N − I) + (b + γ)I
dW
dt,
where W (t) is a Wiener process (white noise), normally distributed, with meanzero and variance t:
W (t) ∼ Normal(0, t), W (t + ∆t) − W (t) ∼ Normal(0, ∆t).
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Three Sample Paths for the SDE SIS Model are ComputedNumerically and Compared to the Deterministic Solution.
R0 = 2
0 5 10 15 20 250
10
20
30
40
50
60
70
80
Time
Num
ber
of In
fect
ives
b = 0.25, γ = 0.25, β = 1, N = 100, I(0) = 2. MATLAB program is in the Appendix.
Note: For large N and I(0), then the SDE model is a good approximationto the CTMC model. However, for small N or I(0), the CTMC model is abetter model.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Some Advantages of the Stochastic Models Over theDeterministic Model for the SIS Epidemic Model:
The SIS Deterministic Model Does Not capture
(i) The Variability Inherent in the Transmission, Recovery, Birth, and DeathProcesses
(ii) The Probability of No Epidemic Occurrence when R0 > 1.
The Stochastic Models Do Capture these Features.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
III. The SIS is a Simple Epidemic Model Because theDynamics Reduce to a Single Variable. This is not the Case
for the SIR Epidemic Model.
First, we review the dynamics of the deterministic SIR Epidemic model.Then we will illustrate some of the differences in the stochastic formulation forthe SIS versus the SIR epidemic model.
Deterministic SIR:
S I R
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Deterministic SIR: S(t) + I(t) + R(t) = N
dS
dt= − β
NSI + b(I + R)
dI
dt=
β
NSI − (b + γ)I
dR
dt= γI − bR
Basic Reproduction Number:
R0 =β
b + γ
If R0 > 1 and b > 0, then limt→∞ I(t) = I > 0.If R0 > 1 and b = 0, then limt→∞ I(t) = 0.
There is an epidemic if R0S(0)
N> 1.
If R0 ≤ 1, then limt→∞ I(t) = 0.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Formulation of a DTMC SIR Epidemic Model Results In AMultivariate Process.
S(t) + I(t) + R(t) = N = maximum population size.
Let S(t) and I(t) denote discrete random variables for the number of susceptibleand infected individuals, respectively. These two variables have a jointprobability function
p(s,i)(t) = Prob{S(t) = s, I(t) = i}
where R(t) = N −S(t)− I(t). For this stochastic process, we define transitionprobabilities as follows:
p(s+k,i+j),(s,i)(∆t) = Prob{(∆S, ∆I) = (k, j)|(S(t), I(t)) = (s, i)}
=
8
>
>
>
>
>
>
>
<
>
>
>
>
>
>
>
:
βi(N − i)∆t/N, (k, j) = (−1, 1)
γi∆t, (k, j) = (0,−1)
bi∆t, (k, j) = (1,−1)
b(N − s − i)∆t, (k, j) = (1, 0)
1 − [βi(N − i)/N + γi + b(N − s)]∆t, (k, j) = (0, 0)
0, otherwise
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Three Sample Paths of the DTMC SIR Epidemic Model areCompared to the Solution of the Deterministic Model.
R0 = 2, b = 0
R0S(0)
N= 1.96.
0 500 1000 1500 20000
5
10
15
20
25
30
35
Time Steps
Num
ber
of In
fect
ives
, I(t
)
∆t = 0.01, N = 100, β = 1, b = 0, γ = 0.5, S(0) = 98, and I(0) = 2.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
The SDE Model for the SIR Epidemic is a System of TwoIto SDEs.
For example, in the case with b = 0,
dS
dt= − β
NSI + B11
dW1
dt+ B12
dW2
dtdI
dt=
β
NSI − γI + B21
dW1
dt+ B22
dW2
dt
where W1 and W2 are two independent Wiener processes and B = (Bij) is the
square root of the following covariance matrix, B =√
Σ,
Σ =
(
βSI/N −βSI/N−βSI/N βSI/N + γI
)
.
Notice that matrix V is positive definite and thus, has a unique positive definitesquare root,
√Σ = B.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
Three Stochastic Sample Paths of the SDE SIR EpidemicModel Are Compared to the Deterministic Solution.
R0 = 2, b = 0
R0S(0)
N= 1.96.
0 5 10 15 200
5
10
15
20
25
30
35
Time
Num
ber
of In
fect
ives
∆t = 0.01, N = 100, β = 1, b = 0, γ = 0.5, I(0) = 2.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
To Summarize the Main Points:
• Stochastic epidemic models capture the variability inherent in thetransmission, recovery, birth and death processes. Here we did not considerenvironmental variability.
• For small population sizes or small number of infected individuals, CTMCor DTMC models with discrete random variables more accurately capture thevariability in the epidemic process than deterministic models.
• The DTMC model may be used to approximate the CTMC model whenthe time interval ∆t is small.
• The SDE model may be used to approximate the CTMC model when thepopulation size and initial values are large.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
(Part II) Stochastic SIS and SIR Epidemic Models areUseful for Quantifying the Following:
(a) Probability of No Epidemic
(b) Stationary or Quasistationary Distribution
(c) Final Size of an Epidemic
(e) Expected Duration of an Epidemic
L.J.S. Allen, TTU Stochastic Epidemic Models - I
References and MATLAB programs:
1. Allen, L. J. S. 2003. An Introduction to Stochastic Processes with Applications to Biology.
Prentice Hall, Upper Saddle River, N.J.
2. Allen, L. J. S. and A. Burgin. 2000. Comparison of deterministic and stochastic SIS and
SIR models in discrete time. Mathematical Biosciences. 163: 1-33.
3. Andersson, H. and T. Britton. 2000. Stochastic Epidemic Models and Their Statistical
Analysis. Lecture Notes in Statistics. Springer-Verlag, New York, Inc.
4. Daley, D. J. and J. Gani. 1999. Epidemic Modelling An Introduction. Cambridge Studies
in Mathematical Biology, Vol. 15. Cambridge University Press, Cambridge.
5. Gard, T. C. 1988. Introduction to Stochastic Differential Equations. Marcel Dekker, Inc.,
New York and Basel.
6. Mode, C. J. and C. K. Sleeman. 2000. Stochastic Processes in Epidemiology. HIV/AIDS,
Other Infectious Diseases and Computers. World Scientific, Singapore, New Jersey.
L.J.S. Allen, TTU Stochastic Epidemic Models - I
MATLAB Programs For:(1) Three Sample Paths for DTMC SIS Model(2) Probability Distribution for the DTMC SIS Model(3) Three Sample Paths for CTMC SIS Model(4) Three Sample Paths for the SDE SIS Model.
(1)
% Matlab Program
% DTMC SIS Epidemic Model
% Three Sample Paths
clear
set(0,’DefaultAxesFontSize’, 18)
beta=1;
g=0.25;
b=0.25;
N=100;
init=2;
dt=0.01;
time=25;
sim=3;
for j=1:sim
L.J.S. Allen, TTU Stochastic Epidemic Models - I
i(1)=init;
for t=1:time/dt
r=rand;
birth=beta*i(t)*(N-i(t))/N*dt;
death=(b+g)*i(t)*dt;
if r<=birth
i(t+1)=i(t)+1;
elseif r>birth & r<=birth+death
i(t+1)=i(t)-1;
else
i(t+1)=i(t);
end
end
if j==1
plot([0:dt:time],i,’r-’,’LineWidth’,2);
hold on
elseif j==2
plot([0:dt:time],i,’g-’,’LineWidth’,2);
else
plot([0:dt:time],i,’b-’,’LineWidth’,2 end
end
L.J.S. Allen, TTU Stochastic Epidemic Models - I
% Euler’s Method for Deterministic SIS Model
y(1)=init;
for k=1:time/dt
y(k+1)=y(k)+dt*(beta*(N-y(k))*y(k)/N-(b+g)*y(k));
end
plot([0:dt:time],y,’k--’,’LineWidth’,2);
hold off
xlabel(’Time’);
ylabel(’Number of Infectives’);
0 5 10 15 20 250
10
20
30
40
50
60
70
Time
Num
ber
of In
fect
ives
L.J.S. Allen, TTU Stochastic Epidemic Models - I
(2)
% Matlab Program
% Discrete Time Markov Chain
% Stochastic SIS epidemic model
% Transition matrix and Graph of Probability Distribution
clear all
set(gca,’FontSize’,18);
set(0,’DefaultAxesFontSize’,18);
time=2000;
dtt=0.01; % Time step
beta=1*dtt;
b=0.25*dtt;
gama=0.25*dtt;
N=100; % Total population size
en=50; % plot every enth time interval
T=zeros(N+1,N+1); % T is the transition matrix, defined below
v=linspace(0,N,N+1);
p=zeros(time+1,N+1);
p(1,3)=1; % Two individuals initially infected
bt=beta*v.*(N-v)/N;
dt=(b+gama)*v;
for i=2:N % Define the transition matrix
T(i,i)=1-bt(i)-dt(i); % diagonal entries
T(i,i+1)=dt(i+1); % superdiagonal entries
L.J.S. Allen, TTU Stochastic Epidemic Models - I
T(i+1,i)=bt(i); % subdiagonal entries
end
T(1,1)=1;
T(1,2)=dt(2);
T(N+1,N+1)=1-dt(N+1);
for t=1:time
y=T*p(t,:)’;
p(t+1,:)=y’;
end
pm(1,:)=p(1,:);
for t=1:time/en;
pm(t+1,:)=p(en*t,:);
end
ti=linspace(0,time,time/en+1);
st=linspace(0,N,N+1);
mesh(st,ti,pm);
xlabel(’number infected’);
ylabel(’time steps’);
zlabel(’probability of infection’);
view(140,30);
axis([0,N,0,time,0,1]);
L.J.S. Allen, TTU Stochastic Epidemic Models - I
0
50
100
0
1000
2000
0
0.25
0.5
0.75
1
StateTime, nP
roba
bilit
y
L.J.S. Allen, TTU Stochastic Epidemic Models - I
(3)
% Matlab Program
% Continuous Time Markov Chain
% SIS Epidemic Model
% Three Sample Paths Compared to the Deterministic Model
clear
set(0,’DefaultAxesFontSize’, 18);
set(gca,’fontsize’,18);
beta=1;
b=0.25;
gam=0.25;
N=100;
init=2;
time=25;
sim=3;
for k=1:sim
clear t s i
t(1)=0;
i(1)=init;
s(1)=N-init;
j=1;
while i(j)>0 & t(j)<time
u1=rand;
u2=rand;
L.J.S. Allen, TTU Stochastic Epidemic Models - I
a=(beta/N)*i(j)*s(j)+(b+gam)*i(j);
probi=(beta*s(j)/N)/(beta*s(j)/N+b+gam);
t(j+1)=t(j)-log(u1)/a;
if u2 <= probi
i(j+1)=i(j)+1;
s(j+1)=s(j)-1;
else
i(j+1)=i(j)-1;
s(j+1)=s(j)+1;
end
j=j+1;
end
plot(t,i,’r-’,’LineWidth’,2)
hold on
end
% Euler’s Method Applied to the Deterministic SIS Epidemic Model
dt=0.01;
x(1)=N-init;
y(1)=init;
for k=1:time/dt
x(k+1)=x(k)+dt*(-beta*x(k)*y(k)/N+(b+gam)*y(k));
y(k+1)=y(k)+dt*(beta*x(k)*y(k)/N-(b+gam)*y(k));
end
plot([0:dt:time],y,’k--’,’LineWidth’,2);
L.J.S. Allen, TTU Stochastic Epidemic Models - I
axis([0,time,0,80]);
xlabel(’Time’);
ylabel(’Number of Infectives’);
hold off
0 5 10 15 20 250
10
20
30
40
50
60
70
80
Time
Num
ber
of In
fect
ives
L.J.S. Allen, TTU Stochastic Epidemic Models - I
(4)
% Matlab Program
% SDE SIS Epidemic Model
% Three Sample Paths using Euler’s Method
clear
beta=1;
b=0.25;
gam=0.25;
N=100;
init=2;
dt=0.01;
time=25;
sim=3;
for k=1:sim
clear i, t
j=1;
i(j)=init;
t(j)=dt;
while i(j)>0 & t(j)<25
mu=beta*i(j)*(N-i(j))/N-(b+gam)*i(j);
sigma=sqrt(beta*i(j)*(N-i(j))/N+(b+gam)*i(j));
rn=randn;
i(j+1)=i(j)+mu*dt+sigma*sqrt(dt)*rn;
t(j+1)=t(j)+dt;
L.J.S. Allen, TTU Stochastic Epidemic Models - I
j=j+1;
end
plot(t,i,’r-’,’Linewidth’,2);
hold on
end
% Euler’s method applied to the deterministic SIS epidemic model.
y(1)=init;
for k=1:time/dt
y(k+1)=y(k)+dt*(beta*(N-y(k))*y(k)/N-(b+gam)*y(k));
end
plot([0:dt:time],y,’k--’,’LineWidth’,2);
axis([0,time,0,80]);
xlabel(’Time’);
ylabel(’Number of Infectives’);
hold off
L.J.S. Allen, TTU Stochastic Epidemic Models - I
0 5 10 15 20 250
10
20
30
40
50
60
70
80
TimeN
umbe
r of
Infe
ctiv
es
L.J.S. Allen, TTU Stochastic Epidemic Models - I