Slides Lecture Modelling Infectious Diseases
Slides Lecture Modelling Infectious Diseases
Introduction
Introduction
Introduction
transmission potential
natural history
incubation time
infectious period
acquired immunity
symptomatic/asymptomatic
Modelling Infectious Diseases 5
Prologue
Natural History
Natural history
Transmission routes
...
Modelling Infectious Diseases 7
Prologue
Historic Pandemics
Historic pandemics
Plague of Justinian, from 541 to 750, killed between 50% and 60%
of Europe’s population
The Black Death of 1347 to 1352 killed 25 million in Europe over 5
years (estimated to be between 25 and 50% of the populations of
Europe, Asia, and Africa - the world population at the time was 500
million)
The introduction of smallpox, measles, and typhus to the areas of
Central and South America by European explorers during the 15th
and 16th centuries caused pandemics among the native inhabitants
Between 1518 and 1568 disease pandemics are said to have caused
the population of Mexico to fall from 20 million to 3 million
Modelling Infectious Diseases 8
Prologue
Historic Pandemics
Historic pandemics
The Influenza Pandemic of 1918 (or the Spanish Flu) killed 25-50
million people
UNAIDS estimates that in 2013, 35 million people live with HIV and
1.5 million people died due to AIDS worldwide
Mathematical Models of Infectious Diseases 9
Part I
Outline
2 Introduction
3 Compartmental Models
Discrete time models
A mathematical intermezzo
Kermack and McKendrick’s Model
The SIR model with vital dynamics
The SIR model with vital dynamics and vaccination
4 Epilogue
Mathematical Models of Infectious Diseases 11
Introduction
Purposes:
prediction: requires the inclusion of known complexities and
population-level heterogeneity
Limitations:
models present a simplification of reality
A good model:
suited to its purpose: simple as possible, but no simpler
λt = βIt
λt = βIt /Nt
Mathematical Models of Infectious Diseases 15
Introduction
Heterogeneity
week vs weekend,
holiday vs non-holiday, . . .
...
Mathematical Models of Infectious Diseases 18
Introduction
Figure 1: Examples of networks used in epidemiology. (a) Contacts between 22 intravenous drug users, as recorded in [3]; squares refer to
primary contacts. Given that the identity of contacts is known, they can be interlinked. (b) Caricature of a snowball sampling algorithm,
squares are primary contacts, diamonds are secondary, and circles are tertiary contacts. Given that the identity of contacts is known they can
be linked. (c) Example of a configuration model network. Each individual has a prescribed degree distribution, which gives rise to “half-
Mathematical Models of Infectious Diseases 19
Introduction
Modeling frameworks
compartmental models
the population is subdivided into broad subgroups (compartments)
metapopulation models
network models
Rules of engagement
State variables
S: susceptible individuals
I : infectious individuals (able to transmit the infectious agent)
R: removed/recovered ind. (not transmitting the infectious agent)
N = S + I + R: total and constant population size
Parameters
β: transmission rate
ν: recovery rate
Force of infection
follows the law of mass action: λt = βIt
Model formulation
SIR model:
Extensions
maternal immunity/passive immunity: MSIR
Equations:
St+1 = St − λt St
It+1 = It + λt St − νIt
Rt+1 = Rt + νIt
risk = 1 − e −rate
a binomial distribution
Consequently β = R0 /(ND)
Mathematical Models of Infectious Diseases 26
Compartmental Models
Discrete time models
# Transmission parameters
R0 = 2.48 # Basic Reproduction number
nu = 1/6 # Recovery rate (in days)
b = nu*R0/N # Infection rate (in days)
# Initial states
Sold = S # Number of Susceptibles at time t=0
Iold = I # Number of Infectious at time t=0
Rold = R # Number of Recovered at time t=0
Mathematical Models of Infectious Diseases 27
Compartmental Models
Discrete time models
# Placeholders
Svec =Sold; Ivec = Iold; Rvec = Rold
stop = FALSE
# Loop - continue until stop=TRUE
while (!stop){
Ih = rbinom(1,Sold,(1-exp(-b*Iold)))
print(Ih)
Rh = rbinom(1,Iold,(1-exp(-nu)))
Sold = Sold-Ih
Iold = Iold+Ih-Rh
Rold = Rold+Rh
Svec = c(Svec,Sold)
Ivec = c(Ivec,Iold)
Rvec = c(Rvec,Rold)
if (Iold==0){stop=T}
}
Mathematical Models of Infectious Diseases 29
Compartmental Models
Discrete time models
Class exercise
βN
R0 constitutes a threshold:
if R0 > 1 then the epidemic can grow
Other notation:
St+δt = St − λt St δt
It+δt = It + λt St δt − νIt δt
Rt+δt = Rt + νIt δt
Next:
Limit for δt → 0:
St+δt − St
lim = −λt St
δt→0 δt
It+δt − It
lim = λt St − νIt
δt→0 δt
Rt+δt − Rt
lim = νIt
δt→0 δt
Mathematical Models of Infectious Diseases 34
Compartmental Models
Discrete time models
Using derivatives:
dSt
= −λt St
dt
dIt
= λt St − νIt
dt
dRt
= νIt
dt
Mathematical Models of Infectious Diseases 35
Compartmental Models
A mathematical intermezzo
x(t) = x(0).
x(t) = x(0) e |r |t .
t → r −1 t, x → Kx.
Analytical solution:
x(0) e t
x(t) = .
1 + x(0)(e t − 1)
Horizontal asymptote:
lim x(t) = 1.
t→+∞
Mathematical Models of Infectious Diseases 37
Compartmental Models
A mathematical intermezzo
”Reference may here be made to the work of Ross and Hudson (1915-17)
in which the same problem is attacked. The problem is here carried to a
further stage, and it is considered from a point of view which is in one
sense more general.[...]”
Kermack-McKendrick’s model
State variables
S: Susceptible individuals
I : Infectious individuals (able to transmit the infectious agent)
R: Removed/Recovered ind. (not transmitting the infectious agent)
N = S + I + R: Total (and constant) population
Parameters
β: transmission rate
ν: recovery rate
dS(t) I
= −βS ,
dt N
dI (t) I
= βS − νI ,
dt N
dR(t)
= νI ,
dt
with N = S + I + R.
Note that the time dependence is not always made explicit in the
notation; here in the right-hand side (RHS) of the equation.
Mathematical Models of Infectious Diseases 41
Compartmental Models
Kermack and McKendrick’s Model
ds(τ )
= −σsi,
dτ
di(τ )
= σsi − i,
dτ
dr (τ )
= i,
dτ
with s + i + r = 1.
Mathematical Models of Infectious Diseases 42
Compartmental Models
Kermack and McKendrick’s Model
dr
= 1 − s0 e −σr − r .
dτ
Assuming σr 1 and developing the exponential term
dr 1
≈ 1 − s0 + (s0 σ − 1)(r ) + s0 σ 2 r 2 := F (r ).
dτ 2
Mathematical Models of Infectious Diseases 44
Compartmental Models
Kermack and McKendrick’s Model
Analytic solution
√
1 √ −q
r (t) = σs 0 − 1 + −q tanh( t − ϕ)
σ 2 s0 2
where √ p
−q = (σs0 − 1)2 + 2s0 i0 σ 2
and σs − 1
0
ϕ = tanh−1 √
−q
Mathematical Models of Infectious Diseases 45
Compartmental Models
Kermack and McKendrick’s Model
Finally, since
dr
i(t) =
dt
1 √ √−q
−2
i(t) = −q cosh t − ϕ
2s0 σ 2 2
Application: Plague-related deaths in Bombay (1905-1906)
Mathematical Models of Infectious Diseases 46
Compartmental Models
Kermack and McKendrick’s Model
di(t)
= βsi − νi,
dt
= (βs − ν)i.
0.5
s0 = 0.99
s0 = 0.9
s0 = 0.8
s0 = 0.7
0.4
s0 = 0.6
s0 = 0.5
Fraction of infectious
0.3
0.2
0.1
0.0
Fraction of susceptible
Having defined R0 ,
0.9
0.8
0.7
Fraction of infected
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
R0
Mathematical Models of Infectious Diseases 51
Compartmental Models
Kermack and McKendrick’s Model
Assumption:
Conclusion:
Question:
How to explore the long-term persistence
and endemic dynamics of an infectious disease?
dS(t) I
= B − βS − µS,
dt N
dI (t) I
= βS − νI − µI ,
dt N
dR(t)
= νI − µR.
dt
Mathematical Models of Infectious Diseases 53
Compartmental Models
Kermack and McKendrick’s Model
S + I + R = N ⇒ B = µN
ds(t)
= µ − βsi − µs,
dt
di(t)
= βsi − νi − µi,
dt
dr (t)
= νi − µr .
dt
Mathematical Models of Infectious Diseases 54
Compartmental Models
Kermack and McKendrick’s Model
Equilibrium values
Setting the right-hand side of the system to 0:
µ − βsi − µs = 0,
βsi − νi − µi = 0,
νi − µr = 0.
Existence of two equilibria:
The trivial equilibrium (disease free equilibrium):
E0 = (1, 0, 0)
E1 = (s1 , i1 , r1 )
µ + ν µ β
= , − 1 , 1 − s1 − i1 .
β β µ+ν
β
E1 is positive ⇔ > 1.
µ+ν
Mathematical Models of Infectious Diseases 55
Compartmental Models
Kermack and McKendrick’s Model
Threshold value
di(t)
= βsi − νi − µi
dt
β = 5, µ = 1/75, ν = 2 ⇒ R0 = 2.49
We have
0.20
di(t)
0.15
> 0 ⇔ βs −(ν+µ) > 0
dt I
0.10
di(t) ν+µ
0.05
>0⇔s>
dt β
0.00
S
Mathematical Models of Infectious Diseases 56
Compartmental Models
Kermack and McKendrick’s Model
Intuitively:
β: the transmission rate
the mean number of new cases produced by an infectious individual
per time unit.
SIR<-function(t,state,parameters)
{
with(as.list(c(state, parameters)),
{
N=S+I+R
dS = mu*N-beta*I*S/N - mu*S
dI = beta*I*S/N - nu*I - mu*I
dR = nu*I -mu*R
list(c(dS, dI, dR))
})
}
Mathematical Models of Infectious Diseases 60
Compartmental Models
Kermack and McKendrick’s Model
Initial values
state = c(S=N-1,I=1,R=0)
Time range:
from T0 = 0 to Tmax = 1000 by step of 0.01
times<-seq(0,1000,by=0.01)
Summary
library(deSolve)
N=50000;R0=2; mu0=1/75; nu0=1/(1/24)
beta0=R0*(mu0+nu0)
parameters = c(mu=mu0,beta=beta0,nu=nu0)
state = c(S=N-1,I=1,R=0)
times = seq(0,1000,by=0.01)
SIR<-function(t,state,parameters)
{
with(as.list(c(state, parameters)),
{
N=S+I+R
dS <- mu*N-beta*I*S/N - mu*S
dI <- beta*I*S/N - nu*I - mu*I
dR <- nu*I -mu*R
list(c(dS, dI, dR))
})
}
require(deSolve)
out<-as.data.frame(ode(y=state,times=times,func=SIR,parms=parameters))
Mathematical Models of Infectious Diseases 62
Compartmental Models
Kermack and McKendrick’s Model
tail(out)
time S I R
99996 999.95 25166.63 164.4616 24668.91
99997 999.96 25166.63 164.4615 24668.91
99998 999.97 25166.63 164.4615 24668.91
99999 999.98 25166.63 164.4615 24668.91
100000 999.99 25166.63 164.4615 24668.91
100001 1000.00 25166.63 164.4615 24668.91
50000
v=1/(1/24) (2 weeks)
40000
30000
susceptible
20000
10000
0
time
Mathematical Models of Infectious Diseases 64
Compartmental Models
Kermack and McKendrick’s Model
Assumptions
SIR model with demography
Model representation
Mathematical Models of Infectious Diseases 65
Compartmental Models
Kermack and McKendrick’s Model
Model formulation
'$ '$ '$
µ(1 − p)N λ - ν - µpN
- S I R
&% &% &%
µ µ µ
? ? ?
dS(t) I
= µ(1 − p)N − βS − µS,
dt N
dI (t) I
= βS − νI − µI ,
dt N
dR(t)
= µpN + νI − µR.
dt
Mathematical Models of Infectious Diseases 66
Compartmental Models
Kermack and McKendrick’s Model
Model formulation
S + I + R = N ⇒ B = µN.
ds(t)
= µ(1 − p) − βsi − µs,
dt
di(t)
= βsi − νi − µi,
dt
dr (t)
= µp + νi − µr .
dt
Mathematical Models of Infectious Diseases 67
Compartmental Models
Kermack and McKendrick’s Model
Equilibrium Values
Setting the right-hand side of the system to 0:
µ(1 − p) − βsi − µs = 0,
βsi − νi − µi = 0,
µp + νi − µr = 0.
Existence of two equilibria
The trivial equilibrium (disease free equilibrium):
E0 = (1 − p, 0, p)
E1 = (s1 , i1 , r1 )
µ+ν µ
= , ((1 − p)R0 − 1) , 1 − s1 − i1 .
β β
Threshold value
Vaccination efficacy:
The efficacy of vaccination programs is governed by the relationship
between vaccination coverage and the basic reproduction number.
Threshold value
−3
x 10
7
proportion of infectious population
0
20
15 1
0.8
10 0.6
5 0.4
Basic reproduction ratio (R0) 0.2
0 Proportion of vaccinated new−born (p)
0
Results
12000
1e+05
10000
8e+04
8000
Number susceptible
Infected individuals
6000
6e+04
4000
4e+04
2000
2e+04
Life-long immunity
µ γ λ κ ν
Birth - M
- S - E - I
- R
µ µ µ µ µ
? ? ? ? ?
Figure: Illustration of the MSEIR model. The individuals enter to the
population protected by maternal antibodies after loosing those they move into
the susceptible class, after infection to the exposed class (infected but not
infectious), after a latent period to the infectious class and after recovering to
the immune class.
ODE system?
Mathematical Models of Infectious Diseases 74
Compartmental Models
Building your own model
dM(t)
= µN − (γ + µ)M
dt
dS(t)
= γM − (λ + µ)S
dt
dE (t)
= λS − (µ + κ)E
dt
dI (t)
= κE − (µ + ν)I
dt
dR(t)
= νI − µR.
dt
where λ = β NI .
In this case the basic reproductive number is given by:
κβ
R0 = .
(κ + µ)(ν + µ)
Mathematical Models of Infectious Diseases 75
Compartmental Models
Building your own model
MSEIR example
MSEIR example
Summary
N=1E5
mu0=1/75; sigma0=1/(3/12);kappa0=1/(2/365);nu0=1/(7/365);
beta0=R0*(kappa0+mu0)*(nu0+mu0)/kappa0
parameters = c(mu=mu0, sigma=sigma0,kappa=kappa0,nu=nu0,beta=beta0)
state = c(M=1, S=N-2,E=0, I=1,R=0)
times=seq(0,1000,by=0.01)
MSEIR=function(t,state,parameters)
{
with(as.list(c(state, parameters)),
{
N=M+S+E+I+R
dM= mu*N-(mu+sigma)*M
dS = sigma*M-beta*I*S/N - mu*S
dE = beta*I*S/N-(kappa+mu)*E
dI = kappa*E - nu*I - mu*I
dR = nu*I -mu*R
list(c(dM, dS, dE, dI, dR))
})
}
Mathematical Models of Infectious Diseases 77
Compartmental Models
Building your own model
Summary
out=as.data.frame(ode(y=state,times=times,func=MSEIR,parms=parameters))
par(mfrow=c(1,2))
#### Time series plot
plot(range(times),c(0,N),xlab="time (years)",
ylab="Fractions",type="n",ylim=c(0,N))
lines(out$time,out$M,lwd=2,col=4)
lines(out$time,out$S,lwd=2,col=1)
lines(out$time,out$E,lwd=2,col=5)
lines(out$time,out$I,lwd=2,col=2)
lines(out$time,out$R,lwd=2,col=3)
legend(mean(times),N,c("Maternal","Susceptible","Exposed",
"Infected","Recovered"),text.col=c(4,1,5,2:3))
##### Phase plan
plot(out$S,out$I ,type="l",main=" ", xlab="Susceptible ", ylab="Infectio
Mathematical Models of Infectious Diseases 78
Compartmental Models
Building your own model
12000
1e+05 Maternal
Susceptible
10000
Exposed
8e+04
Infected
Recovered
8000
6e+04
Infectious
Fractions
6000
4e+04
4000
2e+04
2000
0e+00
Class exercise
The law of mass action as stated before relies on the hypothesis that
infected and susceptible individuals mix homogeneously.
β is thus considered as age and time independent.
A first example
'$ '$
βab -
βaa A B βbb
within group &% βba &%
mixing rate
between groups
mixing rate
Figure: Mixing patterns between two subpopulations: βaa is the mixing rate
within group A, βbb is the mixing rate within group B. βab and βba are the
mixing rates between the two groups.
Mathematical Models of Infectious Diseases 82
Compartmental Models
Who Acquires Infection From Whom?
βaa βab
C= .
βba βbb
Mathematical Models of Infectious Diseases 83
Compartmental Models
Who Acquires Infection From Whom?
dSf
= −βfm Sf (t)Im (t) + νf If (t)
dt
dIf
= βfm Sf (t)Im (t) − νf If (t)
dt
dSm
= −βmf Sm (t)If (t) + νm Im (t)
dt
dIm
= βmf Sm (t)If (t) − νm Im (t).
dt
Assuming Nf = Sf + If and Nm = Sm + Im
dIf
= βfm (Nf − If (t))Im (t) − νf If (t),
dt
dIm
= βmf (Nm − Im (t))If (t) − νm Im (t).
dt
Mathematical Models of Infectious Diseases 85
Compartmental Models
Who Acquires Infection From Whom?
System:
Nf Nm − ρf ρm N f N m − ρf ρm
If (∞) = and Im (∞) = .
ρf + N + N m ρm + N + N f
This equilibrium is positive ⇔ Nf Nm − ρf ρm > 0 or
N f βf N m βm
× = R0,f × R0,m > 1.
vf vm
Mathematical Models of Infectious Diseases 86
Compartmental Models
Who Acquires Infection From Whom?
beta2.i<-0.000006*c(0.25,0.5,1)
beta2.i
y1mat<-y2mat<-matrix(0,length(times),length(beta2.i))
for(i in 1:length(beta2.i)){
parameters <- c(beta1=0.000003,beta2=beta2.i[i],v1=0.007,v2=0.05,N1=10000,N2=15000)
require(deSolve)
out <- as.data.frame(ode(y=state,times=times,func=Gonorrhea,parms=parameters))
y1mat[,i]<-out$IF
y2mat[,i]<-out$IM}
Mathematical Models of Infectious Diseases 87
Compartmental Models
Who Acquires Infection From Whom?
8000
8000
6000 R0_m=1.80
6000
I_female
R0_m=0.90
I_male
4000
4000
2000
2000
R0_m=0.45
0
times times
Mathematical Models of Infectious Diseases 88
Compartmental Models
Who Acquires Infection From Whom?
µ1 λ1 ν1
Birth - S
- I
- R
µ µ µ
@1 @1 @1
R
@ R
@ R
@
µ2 λ2 ν2
Birth - S
µ
- I
- R
2 µ2 µ2
@ @ @
R
@ R
@ R
@
Figure: Illustration of a SIR model with two subpopulations.
Mathematical Models of Infectious Diseases 89
Compartmental Models
Who Acquires Infection From Whom?
Force of infection
Σ2j=1 βij Ij Si = λi Si .
ODE system
dSi (t)
= − Σ2j=1 βij Ij Si + Ni µi − µi Si
dt
dIi (t)
Σ2j=1 βij Ij Si − (µi + νi )Ii
=
dt
dRi (t)
= νi Ii − µi Ri .
dt
We will now consider the symmetric case setting β12 = β21 = α.
Mathematical Models of Infectious Diseases 90
Compartmental Models
Who Acquires Infection From Whom?
Application 2: implementation in R
alpha<-0
parameters <- c(beta11=0.05,beta12=alpha,beta21=alpha,beta22=0.05,
nu1=1/30,nu2=1/30,mu=0.001)
state <- c(S1=0.8,I1=0.2,R1=0,S2=0.8,I2=0.2,R2=0)
times<-seq(0,10000,by=0.01)
SIRtwo<-function(t,state,parameters)
{
with(as.list(c(state, parameters)),
{
dS1 <- -(beta11*I1+beta12*I2)*S1+mu-mu*S1
dI1 <- (beta11*I1+beta12*I2)*S1-nu1*I1-mu*I1
dR1 <- nu1*I1 - mu*R1
dS2 <- -(beta21*I1+beta22*I2)*S2+mu-mu*S2
dI2 <- (beta21*I1+beta22*I2)*S2-nu2*I2-mu*I2
dR2 <- nu2*I2 - mu*R2
list(c(dS1,dI1,dR1,dS2,dI2,dR2))
})
}
Mathematical Models of Infectious Diseases 91
Compartmental Models
Who Acquires Infection From Whom?
Application 2: implementation in R
times<-seq(0,10000,by=0.01)
require(deSolve)
out <- as.data.frame(ode(y=state,times=times,func=SIRtwo,
parms=parameters))
par(mfrow=c(1,1))
plot(out$S1,log(out$I1),type="l",main=" ",
xlab="S",ylab="log(I)",ylim=c(-10,0),xlim=c(0,1))
legend(0,-7.5,c("alpha=0"),lty=c(1:4))
Mathematical Models of Infectious Diseases 92
Compartmental Models
Who Acquires Infection From Whom?
Application 2: results
0
−2
−4
log(I)
−6
alpha=0
−8
alpha=0.025
alpha=0.05
alpha=0.075
−10
S
Mathematical Models of Infectious Diseases 93
Compartmental Models
Who Acquires Infection From Whom?
λ2 ν2
? ? ?
S2 - I2 - R2
µ2 µ µ
2 2
@ @ @
R
@ R
@ R
@
Figure: Illustration of age structured SIR model with two age groups.
Mathematical Models of Infectious Diseases 94
Compartmental Models
Who Acquires Infection From Whom?
Each differential equation represent the change (over time and age)
in the compartment.
∂S(a,t) ∂S(a,t)
∂a + ∂t = −(λ(a, t) + µ(a))S(a, t),
∂I (a,t)
∂a + ∂I ∂t
(a,t)
= λ(a, t)S(a, t) − (ν + α + µ(a))I (a, t),
∂R(a,t) + ∂R(a,t) = νI (a, t) − µ(a)R(a, t),
∂a ∂t
dS1 (t) X
− ΣK
= j=1 β1j Ij S1 + (µi Ni ) − µ1 S1 − η1 S1 ,
dt
i
dI1 (t)
ΣK
= j=1 β1j Ij S1 − ν1 I1 − η1 I1 ,
dt
dR1 (t)
= ν1 I1 − µ1 R1 − η1 R1 .
dt
Mathematical Models of Infectious Diseases 96
Compartmental Models
Who Acquires Infection From Whom?
dSi (t)
= − ΣK
j=1 βij Ij Si + ηi−1 Si−1 − µi Si − ηi Si ,
dt
dIi (t)
ΣK
= j=1 βij Ij Si + ηi−1 Ii−1 − (νi + µi )Ii − ηi Ii ,
dt
dRi (t)
= νi Ii − µi Ri + ηi−1 Ri−1 − ηi Ri .
dt
This model is a cohort age-structured model (CAS-model) with the
disadvantage that people can instantaneously grow older.
Mathematical Models of Infectious Diseases 97
Compartmental Models
Who Acquires Infection From Whom?
Summary
...
Mathematical Models of Infectious Diseases 102
Epilogue
Contact details
Acknowledgements:
Mathieu Andraud
Olivier Lejeune
More in:
Hens, N., Shkedy, Z., Aerts, M., Faes, C., Van Damme, P. and Beutels, P.
“Modeling Infectious Disease Parameters Based on Serological and Social
Contact Data: A Modern Statistical Perspective”
Springer-Verlag New York. 2012
Mathematical Models of Infectious Diseases 103
Epilogue
Becker (1989)
Capasso (2008)
...
Mathematical Models of Infectious Diseases 104
Epilogue