stochastic population modeling - cheikh anta diop...
TRANSCRIPT
Stochastic differential equations
Stochastic population modeling
Benito Chen-Charpentier
Department of Mathematics, University of Texas at Arlington, Arlington, TX76019, USA
African Mathematical School on Insight from MathematicalModeling
into Problems in Conservation, Ecology, and EpidemiologyUniversity of Cheikh Anta Diop, Dakar Senegal
May 2018
Stochastic differential equations
Outline
Introduction
Probability
Brownian Motion
Ito Calculus
Ito Stochastic Differential Equations
Population Models
Numerical methods
Programs
Stochastic differential equations
Introduction
Introduction
An ordinary differential equation
dx
dt= f (x , t), x(t0) = x0
can be written as
dx = f (x , t)dt, x(t0) = x0
or in integral form
x(t) = x0+∫ t
t0f (x(s),s)ds.
Stochastic differential equations
Introduction
A simple example is
dx
dt= a(t)x(t), x(t0) = x0,
which is Malthus model for the growth of a population x .
Stochastic differential equations
Introduction
Usually one considers that a(t) is a deterministic parameter, butmany times due to errors in measurement, variability in thepopulations and other factors that introduce uncertainties, we canthink of a(t) as a random variable, a(t) = a0(t)+h(t)ξ (t), wherea0(t) is the expected value or mean, and ξ (t) is a white noiseprocess. (Later we will define these terms.) If we definedW (t) = ξ (t)dt where dW (t) is the differential form of thebrownian motion, we get
dX (t) = a0(t)X (t)+h(t)X (t)dW (t).
In general an stochastic differential equation is given by
dX (t,ω) = f (X (t,ω), t)+g(X (t,ω), t)dW (t,ω),
where ω is an element of the sample space and X = X (t,ω) is arandom variable or stochastic process. Here we take the initialcondition X (0,ω) = X0 to be known with probability one.
Stochastic differential equations
Introduction
This equation is equivalent to the integral equation
X (t,ω) = X0+∫ t
0f (X (s,ω),s)ds+
∫ t
0g(X (s,ω),s)dW (s,ω),
Later we will see what is the meaning of the stochastic integral,what is a brownian motion, etc.
Stochastic differential equations
Probability
Concepts of probability
I The result of a game or an experiment is many times random.
I For example, if we toss a coin, the possible results are ”heads”(H) or ”tails” (T). They are not predictable
I The sample space Ω is Ω = H,T.I The events are the subsets of Ω, H,T,H,T and /0.I If the coin is not loaded, the probability of a heads is 1/2 and
the probability of a tails is also 1/2.
I That is, if we toss the coin many times we expect to getheads half the time.
Stochastic differential equations
Probability
Another example: A day may be rainy (R), snowy (S) or clear (C)
I The sample space Ω is Ω = R,S ,C.I The events are the subsets of Ω,
R,S,C,R,S,R,C,S ,C,R,S ,C and /0.I The probability of each happening depends on observations
Stochastic differential equations
Probability
Given an event A ∈ Ω, the probability of A, P(A), must satisfy:
1. P(A) ∈ [0,1].
2. P( /0) = 0.
3. P(Ω) = 1.
4. IS A1,A2, . . . is a finite or countable sequence of disjointevents, then P(A1
∪A2 . . .) = P(A1)+P(A2)+ · · ·
Stochastic differential equations
Probability
A random variable (r.v.) is a function that associates randomoutcomes ω in sample space Ω with scalars, usually a subset of thereal numbers. E.g. associate a coin flip resulting in heads with 0,and tails with 1, or any other two numbers. Also, there are manyother possible random variables associated with the sameexperiment.
Stochastic differential equations
Probability
I In an experiment or observation there is a probability space,which is an ordered triple (Ω,A ,P), withI Ω the sample space,I A a collection of subsets of of Ω andI P the probability measure defined on A .
Stochastic differential equations
Probability
More precisely, the probability space is an ordered triple formed by:
I sample space Ω,
I σ -algebra A defined on Ω, and
I probability measure P defined on A .
Stochastic differential equations
Probability
Given a nonempty set Ω, a σ -algebra defined on Ω, A , is acollection of subsets of Ω such that
i) /0 and Ω are both in A ,
ii) if A is in A , then Ac is also in A , where Ac denotes thecomplement of A, and
iii) if Ai is in A for each natural number i , then∪
i∈NAi is in A .
Stochastic differential equations
Probability
A non-negative probability measure is a real map P from aσ -algebra A to [0,1] such that
i) P(B)≥ 0 for all B ∈ A
ii) P(Ω) = 1
iii) If Bi∩Bj = /0 for 1, j = 1,2, . . . , i = j then
P(∪
i∈NBi ) = ∑i∈NP(Bi ), where each Bi ∈ A
Stochastic differential equations
Probability
The Borel σ -algebra G is the smallest σ -algebra that contains allopen sets in Rn. Because of the way a σ -algebra is defined, G alsocontains all closed sets in Rn, countable union of closed sets,countable intersection of open sets, and so on.The measure µG defined on G given by
µG (n
∏i=1
[ai ,bi ]) =n
∏i=1
(bi −ai )
is called the Borel measure
Stochastic differential equations
Probability
Restating: The ordered triple (Ω,B,P) is called a probabilityspace.
I Ω is the space in which the probability outcomes are found,called the sample space.
I B is a σ -algebra on Ω, and the elements of B are calledevents.
I P is called a probability measure, and it is a nonnegativemeasure with the following additional properties:
i) 0≤ P(A)≤ 1 for A ∈ B, andii) P(Ω) = 1.
Stochastic differential equations
Probability
I A random variable X is a map from Ω to R, such that it isB-measurable. That is, a random variable X is a map withthe property that for each x in R, the set ω ∈ Ω : X (ω)≤ xis in B.
I Given an experiment with its associated random variable Xand given a real number x , the probability of the eventω ∈ Ω : X (ω)≤ x is defined as the cumulative distributionfunction of X , and is denoted by
FX (x) = P(ω ∈ Ω : X (ω)≤ x) = P(X ≤ x).
I If the random variable is continuous, then the derivative
fX (x) =dFX (x)
dx
is known as the probability density function of the randomvariable X , if the derivative exists.
Stochastic differential equations
Probability
If the random variable X has a probability density function
fX (x) =1√2πσ2
exp(
(−(x−µ)2
2σ2
),
we say that the variable X has a normal distribution function withmean µ and variance σ2, and it is denoted by
X ∼ N(µ,σ2).
Stochastic differential equations
Probability
A stochastic process is a collection of parameterized randomvariables, usually the parameter is time. It is written asX (t,ω) : t ∈ T ,ω ∈ Ω. For t fixed, X (t,ω) is a random variableand fixing ω ∈Ω, X (t,ω) it is a deterministic function of t that wewill call a trajectory or a realization of the stochastic processX (t,ω).Usually it is just written as X (t).
Stochastic differential equations
Probability
To get information about the variability of a random variable or ofa stochastic process one can use the moments, especially the firstand second. The nth moment of a continuous variable X is
E (X n) =∫RxnfX (x)dx , if the integral exists.
The mean is the first moment
E (X ) =∫
xdF (x),
and the variance is the second central moment
Var(X ) =∫(x−E (X ))2dF (x) =E ((X−E (X )2) =E (X 2)−E (X )2.
The integrals are over the sample space.
Stochastic differential equations
Probability
The conditional expectation of a r.v. X given σ -algebra C denotedby E (X |C ) is the best approximation of X with respect to sets inC .In the special case X is C -measurable,
E (X |C ) = X with probability 1,
and in case X is independent of sets in C ,
E (X |C ) = E (X ) w.p.1.
Stochastic differential equations
Probability
Assume that X (t) : t ∈ [0,∞) is a continuous in time stochasticprocess. Then we say that it is a Markov process if, given anysequence of times 0< t1 < t2, · · ·< tn,
P(X (tn)≤ y |X (0) = x0,X (t1) = x1, . . . ,X (tn−1) = xn−1) =
P(X (tn)≤ y |X (tn−1) = xn−1).
Stochastic differential equations
Brownian Motion
Uncertainty and variability in in physical, biological, social oreconomic phenomena can be modeled using stochastic processes.A class of frequently used stochastic processes is the BrownianMotion or Wiener process.
I First used to model the irregular movement of pollen on thesurface of water, or of dust suspended in the air.
I Has been used to model different random phenomena wherethe next state depends only on the current state.
I Einstein explained it using the kinetic theory of gases.
I Wiener gave a mathematical formulation and therefore it isalso known as a Wiener process.
I Mathematically it is formed by a sequence of random variablesparameterized by time that are independent and identicallydistributed (iid).
Stochastic differential equations
Brownian Motion
Because of the independence assumption, the Brownian Motion isa convenient tool in stochastic modeling.
Stochastic differential equations
Brownian Motion
A stochastic process W (t), t ∈ [0,∞] is a Wiener process (or astandard Brownian motion) if it satisfies:
I It is defined for t ≥ 0 with W0 = 0.
I If 0≤ s < t < ∞, then W (t)−W (s) is normally distributedwith mean 0 and variance t− s, that isW (t)−W (s)∼ N(0, t− s).
I If 0≤ r < s < t < ∞, the increments W (t)−W (s) andW (s)−W (r) are independent.
I Since ∆W (t) =W (t+∆t)−W (t)∼ N(0,∆t) one has thatE (∆W (t))) = 0 and E ((∆W (t))2 =∆t.
Stochastic differential equations
Brownian Motion
I Since E ((∆W (t))2 =∆t, |∆W (t)| is O(∆t1/2) thetrajectories of a Wiener process are continuous: ∆t → 0implies (∆t)1/2 → 0.
I ButdW (T )
dt= lim
∆t→0
∆W (t)
∆t= lim
∆t→0
O(∆t1/2)
∆t
that does not exist.
I The Wiener process also does not have bounded variation andtherefore one can not use integrals like Riemann-Stieltjes.
Stochastic differential equations
Ito Calculus
Ito Calculus
There are many ways to define stochastic integrals. The mostcommon ones are Ito and Stratonovich integrals. Both make sensewhen integrating with respect to Wiener processes, but Ito aremore widely used in biological applications.Ito integral is defined in a similar way to Riemann orRiemann-Sieltjes integrals. Let f (t) be a function of a randomvariable that satisfies
∫ ba E (f 2(t)dt < ∞. Let
a= t1 < t2 < .. . < tn+1 = b be a partition of [a,b] with∆t = ti+1− ti = (b−a)/n, and ∆W (ti ) =W (ti+1)−W (ti ),where W (ti ) is a Wiener process for i = 1, . . . ,n.
Stochastic differential equations
Ito Calculus
Ito integral is defined as∫ b
af (t)dt = l .i .m.n→∞
n
∑k=1
f (tk)[W (tk+1)−W (tk)].
The mean square convergence is defined as l .i .m.n→∞g(n) = G iflimn→∞E ((g(n)−G )2) = 0. Note that the la function is evaluatedat the left hand end point of the subinterval.
Stochastic differential equations
Ito Calculus
I Note that the definition resembles that of Riemann integral.
I But the value of the integral depends on the location offunction evaluation.
I Evaluation at other points lead to different rules.
I Convergence is in the mean square sense.
Stochastic differential equations
Ito Calculus
As with Riemann integrals, some simple Ito integrals can becalculated directly using the definition. For example,∫ b
adW (t) =W (b)−W (a).
Stochastic differential equations
Ito Calculus
Properties of Ito integral:Let f (t) and g(t) be functions with Ito integral defined and α,a,band c constants such that a< c < b, then
I ∫ ba αf (t)dW (t) = α
∫ ba f (t)dW (t)
I ∫ ba (f (t)+g(t))dW (t) =
∫ ba f (t)dW (t)+
∫ ba g(t)dW (t)
I ∫ ba f (t)dW (t) =
∫ ca f (t)dW (t)+
∫ bc f (t)dW (t)
I E(∫ b
a f (t)dW (t))= 0
I E
((∫ ba f (t)dW (t)
)2)=
∫ ba E
(f 2(t)
)dt
Stochastic differential equations
Ito Calculus
Examples
I ∫ ba dW (t) = l .i .m.n→∞ ∑n
k=1)[W (tk+1)−W (tk)] =W (b)−W (a)
I If F (W (t), t) is Ito integrable then∫ ba dF (W (t), t) = F (W (b),b)−F (W (a),a)
I ∫ t0 W (s)dW (s) = 1
2
(W 2(t)− t
)I ∫ b
a W (t)dW (t) = 12
(W 2(b)−W 2(a)
)− 1
2(b−a)
Stochastic differential equations
Ito Calculus
We investigate the expectation of Ito integrals:
E∫ t
0f (s)dWs =E
n
∑k=1
f (tk)[Wk+1−Wk ]
=n
∑k=1
Ef (tk)[Wk+1−Wk ]
=n
∑k=1
E (f (tk)E [Wk+1−Wk ]) = 0
since each E (Wk) = 0.
Stochastic differential equations
Ito Calculus
The variance of Ito integrals leads to the Ito isometry property:
E((∫ t
0f (s,ω)dWs)
2)=
∫ t
0E(f 2(s)
)ds.
Stochastic differential equations
Ito Calculus
The Ito calculus version of the chain rule, known as the Ito formula,for Yt(ω) = U(t,Xt(ω)) with dXt = f (t,ω)dWt , is given by
dYt =(∂U
∂ t+
1
2f 2
∂ 2U
∂X 2
)dt+ f
∂U∂X
dWt .
Note the extra second order term.
Stochastic differential equations
Ito Calculus
A consequence of the Ito formula is∫ t
0WsdWs =W 2
t /2− t/2.
Stochastic differential equations
Ito Calculus
Another consequence of the Ito formula is the Ito-Taylor series,useful in developing numerical schemes.Let Xt be a stochastic process satisfying
Xt = Xt0 +∫ t
t0a(s,Xs)ds+
∫ t
t0b(s,Xs)dWs
for t ∈ [t0,T ] for sufficiently smooth a and b. For twicedifferentiable function f (t,Xt), the Ito formula states that
Stochastic differential equations
Ito Calculus
f (t,Xt) = f (t0,Xt0)+∫ t
t0
∂ f∂ t
ds
+∫ t
t0
(a(s,Xs)
∂ f∂X
+1
2b2(s,Xs)
∂ 2f
∂X 2
)ds
+∫ t
t0b(s,Xs)
∂ f∂X
dWs .
Stochastic differential equations
Ito Calculus
We apply the Ito formula to a and b in
Xt = Xt0 +∫ t
t0a(s,Xs)ds+
∫ t
t0b(s,Xs)dWs
to obtain
Xt = Xt0 +a(t0,Xt0)∫ t
t0ds+b(t0,Xt0)
∫ t
t0dWs +R,
where the higher order terms denoted by R are
Stochastic differential equations
Ito Calculus
R =∫ t
t0
(∫ s
t0(∂a∂ t
+L0a)dz+∫ s
t0L1adWz
)ds
+∫ t
t0
(∫ s
t0(∂b∂ t
+L0 b)dz+∫ s
t0L1bdWz
)dWs
Stochastic differential equations
Ito Calculus
with L0 = a∂
∂X+
1
2b2
∂ 2
∂X 2and L1 = b
∂∂X
.
This is the first order Ito-Taylor expansion. One obtains the secondorder expansion by using the Ito formula for L1b in the remainderR.
Stochastic differential equations
Ito Stochastic Differential Equations
Ito Stochastic Differential Equations
A stochastic process X (t) : t ∈ [0,∞) is said to satisfy an Itostochastic differential equation (SDE), written as
dX (t) = α(X (t), t)dt+β (X (t), t)dW (t),
if for t ≥ 0 it is a solution of the corresponding integral equation
X (t) = X (0)+∫ t
0α(X (τ),τ)dτ +
∫ t
0β (X (τ),τ)dW (τ),
where the first integral is a Riemann integral and the second is anIto stochastic integral.
Stochastic differential equations
Ito Stochastic Differential Equations
A more general form of the chain rule for Ito stochastic calculus,known as Ito’s formula, is:If X (t) is a solution of α(X (t), t)dt+β (X (t), t)dW (t) and
F (x , t) : R× [a,b] with continuous derivatives ∂F∂ t ,
∂F∂x y ∂ 2F
∂x2 , then
dF (X (t), t) = f ((X (t), t)dt+g(X (t), t)dW (t),
con
f (x , t) =∂F∂ t
+α(x , t)∂F∂x
+1
2β 2(x , t)
∂ 2F
∂x2
g(x , t) = β (x , t)∂F∂x
.
The proof is based on the fact that ∆W (t) is O(√∆t).
Stochastic differential equations
Ito Stochastic Differential Equations
Ito’s formula in integral version is:Let X (t) be a stochastic process satisfying
X (t) = X (t0)+∫ t
t0α(X (s),s)ds+
∫ t
t0β (X (s),s)dW (s)
for t ∈ [t0,T ] and for α y β sufficiently smooth. If F (X (t), t) is atwice differentiable function, the Ito’s formula states
F (X (t), t) = F (X (t0), t0)+∫ t
t0
∂F∂ t
ds
+∫ t
t0
(α(X (s),s)
∂F∂x
+1
2β 2(X (s),s)
∂ 2F
∂x2)ds
+∫ t
t0β (X (s),s)
∂F∂x
dWs .
Stochastic differential equations
Ito Stochastic Differential Equations
Example:To calculate
∫ ba W (t)dW (t), consider X (t) =W (t),F (x , t) = x2,
then X (t) satisfies dX (t) = dW (t) so that α = 0 and β = 1
f (x , t) =∂F∂ t
+α(x , t)∂F∂x
+1
2β 2(x , t)
∂ 2F
∂x2= 1
g(x , t) = β (x , t)∂F∂x
= 2x .
ThendF (X (t), t) = f ((X (t), t)dt+g(X (t), t)dW (t)
givesd(W 2(t)
)= dt+2W (t)dW (t).
Integrating
W 2(b)−W 2(a) = b−a+2∫ b
aW (t)dW (t).
Stochastic differential equations
Ito Stochastic Differential Equations
Example:Let X (t) =W (t),F (x , t) = xt, then X (t) satisfies dX (t) = dW (t)so that α = 0 y β = 1 and Ito’s formula gives
dF (W (t), t) = d(tW (t)) =
(∂F∂ t
+1
2
∂ 2F
∂x2
)dt+
∂F∂x
dW (t)
=W (t)dt+ tdW (t).
Integrating
bW (b)−aW (a) =∫ b
aW (t)dt+
∫ b
at dW (t)
Stochastic differential equations
Ito Stochastic Differential Equations
There is a theorem of existence and uniqueness of solutions ofstochastic differential equations ([8])Theorem: Let T > 0,α(x , t),β (x , t) and constants C > 0,D > 0such that
1. |α(x , t)|+ |β (x , t)| ≤ C (1+ |x |) for all x ∈ R, t ∈ [0,T ]
2. |α(x , t)−α(y(t)|+ |β (x , t)−β (y , t)| ≤ D|x−y | for allx ,y ∈ R, t ∈ [0,T ]
then
dX (t) = α(X (t), t)dt+β (X (t), t)dW (t), X (0) = X0
has a unique solution.
Stochastic differential equations
Population Models
Population Models
Example:Consider Malthus population growth model dx = ax(t)dt andconsider that the growth coefficient has a deterministic part and arandom part adt = rdt+hdW (t). The stochastic equation is
dX (t) = rX (t)dt+hX (t)dW (t),
so α(x , t) = rx y β (x , t) = hx . Ito’s formula is
dF (=
(∂F∂ t
+α∂F∂x
+1
2β 2 ∂ 2F
∂x2
)dt+β
∂F∂x
dW (t).
The noise term is called the diffusion term. Noise proportional tothe size of the population is known as multiplicative noise.
Stochastic differential equations
Population Models
If we divide by X (t) and use that d ln(X (t) = dX (t)/X (t) we cantake F (x , t) = ln(x) :
d (ln(X (t))=
(rX (t)
1
X (t)+
1
2h2X (t)2
(− 1
X (t)2
))+hX (t)
1
X (t)dW (t)
= (r − h2
2)dt+hW (t).
Integrating from 0 to t gives
ln
(X (t)
X (0)
)= (r − h2
2t = hW (t)
and therefore
X (t) = X (0)exp
((r − h2
2)t+ rW (t)
).
Stochastic differential equations
Population Models
If we integrate the stochastic differential equation and we take theexpected value
E (X (t)) = E
(∫ t
0rX (s)ds
)+hE
(∫ t
0X (s)dW (s)
)but since
E
(∫ b
af (t)dW (t)
)= 0
we have that E (X (t)) = r∫ t
0E (X (s))ds
orE (X (t))
dt= rE (X (t))
with solution
E (X (t)) = E (x(0))exp(rt) = X (0)exp(rt).
Stochastic differential equations
Population Models
Another alternative is to add a constant multiple of dWt to thedeterministic equation (additive noise)
dX (t) = rX (t)dt+hdW (t),
where we are now assuming that the noise is an environmentalnoise independent of the size of the population.
Stochastic differential equations
Population Models
Using Ito’s formula the exact solution is
Xt = eatX0+∫ t
0ea(t−s)bdWs.
Stochastic differential equations
Population Models
Which of the two formulations is better?For small populations the environmental noise may be dominant.But since environmental fluctuations often are related tooverpopulation in ways such as shortage of food, increasedaggression toward each other, etc., a reasonable way to modify thedeterministic equation is to consider introducing randomness thatis proportional to the size of the population.
Stochastic differential equations
Population Models
Example:In the logistic population growth model it is assumed that thepopulation growth is limited by the competition for resourcesbetween members of the same species and that this competition isproportional to the number of contacts between members of thepopulation, x2. The deterministic equation is
dx = rx (1−x/K )dt
with K a constant known as the carrying capacity. There areseveral ways of obtaining a stochastic equation but the simplestone is to assume that the noise is proportional to the size of thepopulation
dX (t) = rX (t)(1−x/K )dt+σX (t)dW (t).
The exact solution is ([2])
X (t) =exp
((r − σ2
2 t+σW (t))
X−1(0)+ rK
∫ t0 exp
((r − σ2
2 )s+σW (s))ds
.
Stochastic differential equations
Population Models
Other equations with exact solution are
IdX (t) = αdt+βdW (t), α,β ∈ R
X (t) = αt+βW (t)+X (0)
.
I Ornstein-Uhlenbeck (it is the same as Malthus equationpreviously done)
dX (t) =−αX (t)dt+βdW (t)
X (t) = X (0)exp(−αt)+exp(−αt)∫ t
0exp(αs)βdW (s)
IdX (t) = α(t)X (t)dt+β (t)X (t)dW (t)
X (t) = X (0)exp
(∫ t
0(α(s)− 1
2β 2(s))ds+
∫ t
0β (s)dW (s)
)
Stochastic differential equations
Population Models
Monod growth model
dB(t) =
(rB(t)C (t)
k2+C (t)−µB(t)
)dt
dC (t) =−k1B(t)C (t)
k2+C (t)dt
B(t): concentration of bacteria at time tC (t): concentration nutrients at time t
Stochastic differential equations
Population Models
A system of stochastic differential equations based on Monod’smodel is
dB(t) =
(rB(t)C (t)
k2+C (t)−µB(t)
)dt+ eB(t)dW (t),
dC (t) =−k1B(t)C (t)
k2+C (t)dt+ fC (t)dU(t).
This system does not have an exact solution.
Stochastic differential equations
Population Models
SIR epidemic modelThe deterministic model is
dS
dt=− β
NSI
dI
dt=
βNSI − γI
dR
dt= γI ,
where S is the susceptible individuals, I the infective and infectiousindividuals, and R the recovered with immunity individuals. β isthe contact rate, γ the recovery rate and N the total population.Only the first two equations need to be considered.
Stochastic differential equations
Population Models
There are many different ways of obtaining a stochastic system
dS =− βNSIdt+b1dW1(t)
dI = (βNSI − γI )dt+b2dW2(t).
The noise is considered environmental
Stochastic differential equations
Population Models
A second way is to consider that the noise depends on the size ofthe corresponding population
dS =− βNSIdt+b1SdW1(t)
dI = (βNSI − γI )dt+b2IdW2(t).
Stochastic differential equations
Population Models
A third way of obtaining a stochastic system is to consider thatsome of the coefficients have a deterministic and an a random part
dS =− βNSIdt+b1
βNSIdW1(t)− γIdW2(t)
dI = (βNSI − γI )dt+b1
βNSIdW1(t)+b2− γIdW2(t).
Stochastic differential equations
Population Models
A fourth way is to start with a discrete time Markov chain,calculate the probabilities of a population going or exiting a givenstate. The expectation and covariance matrix are calculatd andunder certain assumptions (Central limit theorem and others) astochastic system is derived. It is not unique ([1])
dS =− βNSIdt+G11dW1(t)+G12dW2(t)
dI = (βNSI − γI )dt+G21dW1(t)+G22dW2(t),
where
G 2 =
(βSI/N −βSI/N−βSI/N βSI/N+ γI
)
Stochastic differential equations
Population Models
SIRS epidemic modelThe deterministic model is
dS
dt=− β
NSI + cR
dI
dt=
βNSI − γI
dR
dt= γI − cR,
where S is the susceptible individuals, I the infective and infectiousindividuals, and R the recovered with temporary immunityindividuals. β is the contact rate, γ the recovery rate and N thetotal population. Since the total population is constant, R can beeliminated and only the first two equations need to be considered.Stochastic models can be derived similarly to the SIR.
Stochastic differential equations
Population Models
SIRS epidemic model with vaccination Vaccinated individuals getpartial immunity and may become susceptible or infected. Afraction α of the newborns are vaccinated and the birth rate µ isequal to the death rate of all compartments, so the totalpopulation N is constant.
Stochastic differential equations
Population Models
The deterministic model is
dS
dt= (1−α)µN− β
NSI −µS−ϕS+δV + cR
dI
dt=
βNSI +σ
βNVI − (γ +µ)I
dR
dt= γI − (µ + c)R
dV
dt= αµN+ϕS− (δ +µ)V −σ
βNVI ,
where V is the vaccinated individuals, ϕ is the vaccination rate ofsusceptible individuals, σ the effectiveness of the vaccine (between0 and 1), and δ the loss of immunity due to the vaccine. SinceV = N−S− I −R the last equation can be eliminated.
Stochastic differential equations
Numerical methods
Numerical methods
A numerical solution of the stochastic differential equation
dX (t) = α(X (t), t)dt+β (X (t), t)dW (t) in [0,T ], X (0) = X0
is a stochastic process that solves the equivalent equation whenthe differentials are replaced by difference approximations. Take apartition of [0,T ];
0 = t0 < t1 < .. . < tk−1 < tk = T .
The mesh of the partition is
δ (k) = maxi=1,...,k
(ti − ti−1).
Stochastic differential equations
Numerical methods
A measure of the error of the approximation for a given trajectory is
εs(δ (k)) = E |X (T ,ω)−Xk(T ,ω)|,
where X (T ,ω) is the exact solution on a given Brownian path andXk(T ,ω) is the solution of the difference equation. A strongnumerical solution of an Ito stochastic differential equation is astochastic process Xk(t) that satisfies
εs(δ (k))→ 0 as δ (k)→ 0.
Stochastic differential equations
Numerical methods
A weak numerical solution only aims at approximating themoments of the solution X . That is its probability distributionfunction approximates that of the exact solution. Theapproximation is not path-wise. Let
εw (δ (k)) = E |f (X (T ))− f (Xk(T ))|,
where the f is usually a polynomial so we get the moments. Aweak numerical solution of an Ito stochastic differential equation isa stochastic process Xk(t) that satisfies
εw (δ (k))→ 0 as δ (k)→ 0.
Stochastic differential equations
Numerical methods
The numerical solution Xk converges strongly with order γ > 0 ifthere exists a constant c > 0 such that
εs(δ )k))< cδ (k)γ
for all partitions.The numerical solution Xk converges weakly with order γ > 0 ifthere exists a constant c > 0 such that
εw (δ )k))< cδ (k)γ
for all partitions.
Stochastic differential equations
Numerical methods
Euler-Murayama methodConsider the stochastic differential equation
dX (t) = α(X (t), t)dt+β (X (t), t)dW (t) in [0,T ], X (0) = X0
Take a uniform partition of [0,T ];
0 = t0 < t1 < .. . < tk−1 < tk = T , ∆t = ti+1− ti =T
k
So that ti+1 = ti +∆t = i∆t.
Y ∆Wi =∆W (ti ) =W (ti +∆t)−W (ti ).
In the method of Euler-Murayama, which is the simplest one,
dX (ti )≈∆X (ti ) = X (ti+1)−X (ti ) y dW (ti )≈∆Wi .
Therefore
Xi+1 = Xi +α(Xi , ti )∆t+β (Xi , ti )∆Wi
Stochastic differential equations
Numerical methods
Since ∆Wi ∼ N(0,∆t) if η ∼ N(0,1) then√∆tη ∼ N(0,∆t). To
generate a trajectory or realization it is necessary to generaterandom values of ηi .
Xi+1 = Xi +α(Xi , ti )∆t+β (Xi , ti )√∆tηi , i = 0,1, . . . ,k−1
X (0) = X0.
The error satisfies:
E (|X (ti )−Xi |2|X (ti−1)−Xi−1) = O(∆t2) (one step)
E (|X (ti )−Xi |2|X (0)−X0) = O(∆t).
Order of weak convergence equal to 1. And
X (ti )−Xi = O(∆t).5
Order of strong convergence equal to .5
Stochastic differential equations
Numerical methods
Milstein method
The method of Milstein is
Xi+1 = Xi +α(Xi , ti )∆t+β (Xi , ti )∆Wi
+1
2β (Xi , ti )
∂β (Xi , ti )
∂x[(∆Wi )
2−∆t].
The order of strong convergence is 1.
Stochastic differential equations
Programs
Programs
The next program in octave and Matlab solves Malthus populationgrowth model:
dX (t) = r X (t)dt+ c X (t)dW (t).
The exact solution is :
X (t) = X0 exp((r −1
2c2)t+ cW (t)).
Stochastic differential equations
Programs
1 c l e a r ; c l f ;2 T=1; % maximum time3 r =1/2;4 c =.1 ;% c o e f f i c i e n t s o f the equa t i on5 k=100; % number o f s u b i n t e r v a l s6 d e l t a t=T/k ;7 d e l t a t 2=s q r t ( d e l t a t ) ;8 npath=4;% number o f t r a j e c t o r i e s . The l a s t one i s
d e t e rm i n i s t i c9 f o r j =1: npath
10 i f j==npath11 c =0. ;12 end13 X(1) =1. ;14 f o r i =1:k15 X( i +1)=X( i ) +r ∗ X( i ) ∗ d e l t a t+ c∗ X( i ) ∗ d e l t a t 2 ∗
randn ;16 end17 p l o t ( [ 0 : d e l t a t :T] ,X, ’ L ineWidth ’ , 2 ) ;
Stochastic differential equations
Programs
18 ho ld on19 end20 t i t l e ( ’ Eu l e r−Murayama ’ ) ;21 x l a b e l ( ’ t ’ ) ;22 y l a b e l ( ’X( t ) ’ ) ;
Stochastic differential equations
Programs
0 0.2 0.4 0.6 0.8 10.8
1
1.2
1.4
1.6
1.8
t
X(t
)
Euler-Murayama
Figure: Method of Euler for the model of Malthus. The smoothtrajectory is the deterministic solution.
Stochastic differential equations
Programs
The next code in octave and Matlab solves the logistic equationusing the method of Euler
Stochastic differential equations
Programs
1 c l e a r ; c l f ;2 T=10; %maximum time3 r =1/2;4 b=.1;% c o e f f i c i e n t s o f the equa t i on5 k=100; % number o f s u b i n t e r v a l s6 K=2% c a r r y i n g c a p a c i t y7 d e l t a t=T/k ;8 d e l t a t 2=s q r t ( d e l t a t ) ;9 npath=4;% number o f t r a j e c t o r i e s ; the l a s t one i s
d e t e rm i n i s t i c10 f o r j =1: npath11 i f j==npath12 b=0. ;13 end14 X(1) =1. ;15 f o r i =1:k16 X( i +1)=X( i ) +r ∗ X( i ) ∗(1.−X( i ) /K) ∗ d e l t a t+ b∗ X( i )
∗ d e l t a t 2 ∗ randn ;17 end
Stochastic differential equations
Programs
18 p l o t ( [ 0 : d e l t a t :T] ,X, ’ L ineWidth ’ , 2 ) ;19 ho ld on20 end21 t i t l e ( ’ Eu l e r−Murayama ’ ) ;22 x l a b e l ( ’ t ’ ) ;23 y l a b e l ( ’X( t ) ’ ) ;
Stochastic differential equations
Programs
0 2 4 6 8 100.5
1
1.5
2
2.5
t
X(t
)
Euler-Murayama
Figure: Euler method for the logistic model. The smooth trajectory is thedeterministic solution.
Stochastic differential equations
Programs
The following program calculates the mean of 500 trajectoriesproduced by the methods of Euler and Milstein for the model ofMalthus and compares them with the expected value of the exactsolution of the stochastic equation.
Stochastic differential equations
Programs
1 %Compares the ave rage o f Eu l e r and M i l s t e i n w i th theexac t f o r the equa t i on dX=rX dt +cX dW, X(0)=X0
2 c l e a r ; c l f ;3 nsim=500; % number o f t r a j e c t o r i e s4 T=3; % maximum time5 r =1/2;6 c =.1 ;% c o e f f i c i e n t s o f the equa t i on7 k=30; k1=k+1;% number o f s u b i n t e r v a l s8 d e l t a t=T/k ;9 d e l t a t 2=s q r t ( d e l t a t ) ;
10 X0=1. ;11 Xe=ze r o s ( nsim , k1 ) ;12 Xm=ze r o s ( nsim , k1 ) ;13 f o r m=1: nsim14 Xe(m, 1 )=X0 ;15 Xm(m, 1 )=X0 ;16 f o r i =1:k17 dw=d e l t a t 2 ∗ randn ;18 Xe(m, i +1)=Xe(m, i )+r ∗Xe(m, i ) ∗ d e l t a t+c∗Xe(m, i ) ∗dw ;
Stochastic differential equations
Programs
19 Xm(m, i +1)=Xm(m, i ) +r ∗ Xm(m, i ) ∗ d e l t a t+ c∗ Xm(m, i ) ∗ dw+ . . .
20 . 5∗ c∗Xm(m, i ) ∗c ∗(dwˆ2− d e l t a t ) ;21 end22 end23 meanXe=sum(Xe) /nsim24 meanXm=sum(Xm)/nsim25 EX=X0∗ exp ( r ∗ ( 0 : d e l t a t :T) ) ;26 p l o t ( [ 0 : d e l t a t :T] , EX, ’ k− ’ , [ 0 : d e l t a t :T] , meanXe , ’ r
−−∗ ’ , [ 0 : d e l t a t :T] , meanXm, ’ b−. x ’ , ’ L ineWidth ’ , 2 ) ;27 t i t l e ( ’ Eu l e r−Mi l s t e i n−Exact ’ ) ;28 x l a b e l ( ’ t ’ ) ;29 y l a b e l ( ’X( t ) ’ ) ;30 l e g end ( ’ Expected v a l u e ’ , ’Mean Eu le r−Murayama ’ , ’Mean
M i l s t e i n ’ )31 d i f f X e=abs (meanXe ( k )−EX( k ) )32 di f fXm=abs (meanXm( k )−EX( k ) )
Stochastic differential equations
Programs
0 0.5 1 1.5 2 2.5 31
1.5
2
2.5
3
3.5
4
4.5
t
X(t
)
Euler-Milstein-Exact
Expected value
Mean Euler-Murayama
Mean Milstein
Figure: means of the methods of Euler and Milstein for Malthus model,and the expected value of the exact solution.
Stochastic differential equations
Programs
The next program solves the Monod model using the method ofMilstein
1 %Method o f M i l s t e i n f o r the Monod system andd e t e rm i n i s t i c s o l u t i o n
2 %dB=(rBC/( k2+C)−mu B) dt + s1 B dW; dC=−k3B C/( k2+C) dt+s2 C dU
3 c l e a r ; c l f ;4 T=5; % maximum time5 r =2. ;6 k2=1. ; k3=1. ; mu=1/2; s1 =.05; s2 =.05;% c o e f f i c i e n t s o f
the equa t i on7 k=200; k1=k+1;% number o f s u b i n t e r v a l s8 d e l t a t=T/k ;9 d e l t a t 2=s q r t ( d e l t a t ) ;
10 B0=1. ; B(1 )=B0 ; Bd(1 )=B0 ;11 C0=10. ; C(1 )=C0 ; Cd (1 )=C0 ;12 randn ( ’ s t a t e ’ ,10) ;13 f o r i =1:k14 dw=randn (2 , 1 )
Stochastic differential equations
Programs
15 B( i +1)=B( i )+( r ∗B( i ) ∗C( i ) /( k2+C( i ) )−mu∗B( i ) ) ∗ d e l t a t+s1∗B( i ) ∗dw(1) + . . .
16 s1 ˆ2∗B( i ) ∗(dw(1)ˆ2− d e l t a t ) / 2 . ;17 C( i +1)=C( i )−r ∗B( i ) ∗C( i ) /( k2+C( i ) ) ∗ d e l t a t+s2 ∗C( i ) ∗dw
(2) + . . .18 s2 ˆ2∗C( i ) ∗(dw(2)ˆ2− d e l t a t ) / 2 . ;19 Bd( i +1)=Bd( i )+( r ∗Bd( i ) ∗Cd( i ) /( k2+Cd( i ) )−mu∗Bd( i ) ) ∗
d e l t a t ;20 Cd( i +1)=Cd( i )−r ∗Bd( i ) ∗Cd( i ) /( k2+Cd( i ) ) ∗ d e l t a t ;21 end22 p l o t ( [ 0 : d e l t a t :T] , Bd , ’ k− ’ , [ 0 : d e l t a t :T] ,B, ’ r−−∗ ’ ,
[ 0 : d e l t a t :T] , Cd , ’ b−. x ’ , [ 0 : d e l t a t :T] , C , ’ g−−+’ , ’L ineWidth ’ , 2 ) ;
23 t i t l e ( ’Monod M i l s t e i n and d e t e rm i n i s t i c ’ ) ;24 x l a b e l ( ’ t ’ ) ;25 y l a b e l ( ’B( t ) , C( t ) ’ ) ;26 l e g end ( ’ Ba c t e r i a d e t e rm i n i s t i c ’ , ’ B a c t e r i a M i l s t e i n ’ , ’
Nu t r i e n t d e t e rm i n i s t i c ’ , ’ Nu t r i e n t M i l s t e i n ’ )
Stochastic differential equations
Programs
0 1 2 3 4 50
2
4
6
8
10
12
t
B(t
), C
(t)
Monod Milstein and deterministic
Bacteria deterministic
Bacteria Milstein
Nutrient deterministic
Nutrient Milstein
Figure: Method of Milstein for the model of Monod.
Stochastic differential equations
Programs
0 10 20 30 40 50-20
0
20
40
60
80
100
t
S(t
), I(
t)
SIR additive Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIR model with environmental(additive) noise. The smooth trajectory is the deterministic solution.
Stochastic differential equations
Programs
0 10 20 30 40 500
20
40
60
80
100
t
S(t
), I(
t)
SIR multiplicative Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIR model with multiplicative noise(proportional to the population size). The smooth trajectory is thedeterministic solution.
Stochastic differential equations
Programs
0 10 20 30 40 500
20
40
60
80
100
t
S(t
), I(
t)
SIRS additive Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIRS model with low additive noise.The smooth trajectory is the deterministic solution.
Stochastic differential equations
Programs
0 10 20 30 40 500
20
40
60
80
100
t
S(t
), I(
t)
SIRS additive Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIRS model with higher additive noise.The smooth trajectory is the deterministic solution.
Stochastic differential equations
Programs
0 10 20 30 40 500
20
40
60
80
100
t
S(t
), I(
t)
SIRS multiplicative Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIRS model with multiplicative noise.The smooth trajectory is the deterministic solution.
Stochastic differential equations
Programs
0 10 20 30 40 500
20
40
60
80
100
t
S(t
), I(
t)
SIRSV multiplicative Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIRSV model with multiplicative noiseand medium vaccine efficiency. The smooth trajectory is thedeterministic solution.
Stochastic differential equations
Programs
0 10 20 30 40 500
20
40
60
80
100
t
S(t
), I(
t)
SIRSV multiplicative Milstein and deterministic
Suscpetible deterministic
Susceptible Milstein
Infected deterministic
Infected Milstein
Figure: Method of Milstein for the SIRSV model with multiplicative noiseand total efficiency σ = δ = 0. The smooth trajectory is the deterministicsolution.
Stochastic differential equations
Programs
I The paper by Higham [4] has programs in octave and Matlab.The programs are inhttp://personal.strath.ac.uk/d.j.higham/algfiles.html
I Software package SDEtoolbox has programs for severalmodels. It can be downloaded fromhttp://sdetoolbox.sourceforge.net/
Stochastic differential equations
Programs
Allen, E. , 2007, Modeling with Ito Stochastic DifferentialEquations, Springer, Dordrecht, The Netherlands.
Allen, L., 2010, An Introduction to Stochastic Processes withApplications to Biology, 2nd edition, CRC Press, Boca Raton.
Evans, L. C., An Introduction to Stochastic DifferentialEquations, Version 1.2,http://www.gaianxaos.com/pdf/stochastics/stochastic diffeq.pdf
Higham, D. J., 2001, An Algorithmic Introduction toNumerical Simulation of Stochastic Differential Equations,SIAM REVIEW, Society for Industrial and AppliedMathematics Vol. 43, pp. 525–546.
Ito, K., and McKean, H.P.,Jr., 1965, Diffusion Processes andTheir Sample Paths, Academic Press. N.Y.
Stochastic differential equations
Programs
Kloeden, P.E., and Platen, E., 1995, Numerical Solution ofStochastic Differential Equations, Springer. N.Y.
McKean, H.P.,Jr., 1969, Stochastic Integrals, Academic Press.N.Y.
Oksendal, B., 1995, Stochastic Differential Equations. AnIntroduction with Applications, 4th edition. Springer. N.Y.
Schuss, Z., 1980, Theory and Applications of StochasticDifferential Equations, John Wiley and Sons. N.Y.