Professional Documents
Culture Documents
MODELS-PART I
Linda J. S. Allen
Department of Mathematics and Statistics
Texas Tech University
Lubbock, Texas U.S.A.
Outline of Presentation-PART I
I. What is a Stochastic Model and What is the Difference Between a
Deterministic and Stochastic Model?
II. Some Stochastic Models are Illustrated Through Study of an SIS Epidemic
Model.
(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.
30
25
20
15
10
5
0
0
500
1000
Time Steps
1500
2000
dS
dt
dI
dt
=
=
SI + (b + )I
N
SI (b + )I
N
R0 =
b+
(b + )it = d(i)t,
1 [i(N i)/N + (b + )i]t =
pji(t) =
1 [b(i) + d(i)]t,
0,
j =i+1
j =i1
j=i
j 6= i + 1, i, i 1,
1
d(1)t
0
0 1 [b(1) + d(1)]t
d(2)t
0
b(1)t
1 [b(2) + d(2)]t
0
0
b(2)t
.
..
..
.
0
0
0
0
0
0
..
.
0
..
d(N )t
1 d(N )t
lim p0(t) = 1.
Number of Infectives
60
50
40
30
20
10
0
0
10
15
20
25
Time
Probability
1
0.75
0.5
0.25
0
0
0
1000
50
2000 100
Time, n
State
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.
1
R0
I(0)
2
1
1
= .
=
2
4
pji(t) =
j =i+1
j =i1
j=i
otherwise,
where o(t) 0 as t 0.
i i + 1, i i 1, or i i.
L.J.S. Allen, TTU
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 differential
equations.
L.J.S. Allen, TTU
d(1)
[b(1) + d(1)]
b(1)
0
...
0
0
0
d(2)
[b(2) + d(2)]
b(2)
...
0
0
...
0
0 C
C
0 C
C
C
0 C.
C
...
C
C
d(N ) A
d(N )
P (t) I
p(t)
t
= Qp
where
P (t) I
Q = lim
.
t0
t
The Discrete-Time Process can be used to Approximate the ContinuousTime Process.
L.J.S. Allen, TTU
j=0,j6=n
and
pnn(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
j=0,j6=n
a(n) =
n(N n) + (b + )n
N
Prob{Fn (U ) t}
Prob{Fn(Fn (U )) Fn(t)}
Prob{U Fn(t)}
Fn(t)
ln(U )
ln(1 U )
=
.
a(n)
a(n)
Number of Infectives
70
60
50
40
30
20
10
0
0
10
15
20
25
Time
p(x, t)dx.
a
We can derive a system of differential equations satisfied by the pdf. This system
of equations is also known as the forward Kolmogorov differential equations:
p
{[x(N x)/N (b + )x]p}
=
t
x
1 2 {[x(N x)/N + (b + )x]p}
+
,
2
2
x
x [0, N ], t [0, ). The first term is known as the drift and second term
diffusion.
L.J.S. Allen, TTU
dI
= I(N I) (b + )I +
dt
N
dW
I(N I) + (b + )I
,
N
dt
where W (t) is a Wiener process (white noise), normally distributed, with mean
zero 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.
1
0.5
W(t)
-0.5
-1
-1.5
0.2
0.4
0.6
0.8
Time
p
dW
dI
= b(I) d(I) + b(I) + d(I)
dt
dt
t Normal(0, t).
Stochastic Epidemic Models - I
= I(N I) (b + )I +
dt
N
dW
I(N I) + (b + )I
,
N
dt
where W (t) is a Wiener process (white noise), normally distributed, with mean
zero and variance t:
W (t) Normal(0, t), W (t + t) W (t) Normal(0, t).
Three Sample Paths for the SDE SIS Model are Computed
Numerically and Compared to the Deterministic Solution.
R0 = 2
80
Number of Infectives
70
60
50
40
30
20
10
0
0
10
15
20
25
Time
Note: For large N and I(0), then the SDE model is a good approximation
to the CTMC model. However, for small N or I(0), the CTMC model is a
better model.
L.J.S. Allen, TTU
= SI + b(I + R)
N
=
SI (b + )I
N
= I bR
b+
Let S(t) and I(t) denote discrete random variables for the number of susceptible
and infected individuals, respectively. These two variables have a joint
probability 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 transition
probabilities 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)
>
>
>
>
it,
(k, j) = (0, 1)
>
>
<
bit,
(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
30
25
20
15
10
5
0
0
500
1000
Time Steps
1500
2000
dW1
dW2
SI + B11
+ B12
N
dt
dt
dW1
dW2
SI I + B21
+ B22
N
dt
dt
=
=
SI/N
SI/N
SI/N
.
SI/N + I
square root, = B.
Number of Infectives
30
25
20
15
10
5
0
0
10
Time
15
20
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
70
Number of Infectives
60
50
40
30
20
10
0
0
10
15
20
25
Time
(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
Probability
1
0.75
0.5
0.25
0
0
0
1000
50
2000 100
Time, n
State
(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
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
% Eulers 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
axis([0,time,0,80]);
xlabel(Time);
ylabel(Number of Infectives);
hold off
80
Number of Infectives
70
60
50
40
30
20
10
0
0
10
15
20
25
Time
(4)
% Matlab Program
% SDE SIS Epidemic Model
% Three Sample Paths using Eulers 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
j=j+1;
end
plot(t,i,r-,Linewidth,2);
hold on
end
% Eulers 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
80
Number of Infectives
70
60
50
40
30
20
10
0
0
10
15
20
25
Time