0% found this document useful (0 votes)
12 views17 pages

Presentation 1

The document outlines a tutorial on SIR-like models, focusing on the structure of the session, historical context, and mathematical formulations of epidemic models. It covers topics such as numerical integration of ODEs, model explorations using Shiny, and insights into epidemic dynamics, including the importance of R0 and herd immunity. Additionally, it provides resources for further learning, including R packages and online applications related to infectious disease modeling.

Uploaded by

Mado Saeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views17 pages

Presentation 1

The document outlines a tutorial on SIR-like models, focusing on the structure of the session, historical context, and mathematical formulations of epidemic models. It covers topics such as numerical integration of ODEs, model explorations using Shiny, and insights into epidemic dynamics, including the importance of R0 and herd immunity. Additionally, it provides resources for further learning, including R packages and online applications related to infectious disease modeling.

Uploaded by

Mado Saeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

A tutorial on SIR(-like) models

Ottar Bjornstad – Penn State University


[email protected]
Structure of day

• Bit of logistics (ppt)


• Introductory remarks (ppt)
• Equations (whiteboard)
• Intuit epidemic curve
• R0
• Pc

• Numerical integration of ODEs (R)


• Invasion towards endemic equilibria
• Prevalence vs incidence

• Model explorations (Shiny)


• Model elaborations (whiteboard)
• SEIR
• Rates vs probabilities

• Further insights
Some logistics (1)
https://www.niss.org/events/nissasa-tutorial-susceptible-infected-recovered-sir-modeling

Two recent 2-page tutorials:


Bjørnstad, O.N., Shea, K., Krzywinski, M. and Altman, N., "Modeling infectious epidemics." Nature methods 17
(2020): 455-456.
with associated online Shiny App https://shiny.bcgsc.ca/posepi1/

Bjørnstad, O.N., Shea, K., Krzywinski, M. and Altman, N., "The SEIRS model for infectious disease dynamics."
Nature methods 17 (2020): 557-558.
with associated online Shiny App https://shiny.bcgsc.ca/posepi2/

All the data and functions to be discussed are in the R-package: https://CRAN.R-project.org/package=epimdr

OPEN SCIENCE: ALL material discussed is CC-NC-BY licensed (version 4.0 or higher), So grab it, monkey with it
repurpose, enhance and expand as long as its done with CC-NC-BY
Some logistics (2)

All the data and functions to be discussed are in the R-package: https://CRAN.R-project.org/package=epimdr

To follow along in RStudio install and attach key packages:

install.packages("epimdr")
install.packages("deSolve")
install.packages("shiny")
install.packages("polspline")

require("epimdr")
Bit of History
Measles Niamey, Niger 2003-2004

• There is no “THE SIR MODEL”.

200
• MathEpi shorthand for a class of more or less complicated

150
compartmental models

Incidence
• Original SIR model by Kermack and McKendrick (1927) was a set of

100
elaborate integrodifferential renewal equations
• Are there laws for the shape of epidemics?

50
• Will everybody be infected?

0
• Bartlett 1957 Stoch Diff Eq versions 1 15 29 43 57 71 85 99 115 133 151 169 187 205 223

Day
• Bailey 1956 introduced discrete time (“chain-binomial”) stochastic
versions

• The short-hand today is most commonly used to refer to the simpler


of the deterministic ordinary differential compartmental formulations
Flows of transmisson
S – Susceptible
I – Infected and infectious
R – Recovered and immune
(E – “Exposed” – Infected but not yet infectious)
• Infection is for life: S -> I
• Immunity following infection is for life: S -> I -> R
• Significant lag between exposure and infectious: S -> E -> I -> R
• Impermanent immunity: S -> (E -> ) -> I -> R -> S

-> White board


The “closed SIR epidemic” (no susceptible recruitment) R0 = # of infecteds expected from index
case in a population of susceptibles

• Initial exponential growth (and exponential depletion of S)

• Turning-point is when contacts among infecteds and susceptibles becomes


too rare for replacement (S = 1/R0).
• Vaccine target for herd immunity = 1 - 1/R0

• In absence of births epidemics will self-extinguish with a fraction of S left


behind (≈ exp[-R0])
The S-I-R model

Change in S = + new births – new infections - deaths

Per infectious rate Probability of Probability that


Number of
of contact with * Infection given * ‘contactee’ is * infectious
others contact suceptible
The simple S-I-R model

Change in S = + new births – new infections - deaths

Per infectious rate Probability of Probability that


Number of
of contact with * Infection given * ‘contactee’ is * infectious
others contact suceptible

Transmisssion rate, β
The simple S-I-R model

Change in S = + new births – new infections - deaths

Per infectious rate Probability of Probability that


Number of
of contact with * Infection given * ‘contactee’ is * infectious
others contact suceptible

Transmisssion rate, β

In stable pop:
mu=nu
Change in I = + new infections – new recovered - deaths

When calculating we
usually set N = 1 so
each variable is the
fraction of population
#1 require(deSolve)
The recipe for integrating
the SIR ode’s (and other
#2 sirmod=function(t, y, parms){
ode’s in R)
S=y[1]; I=y[2]; R=y[3]
beta= parms["beta"]; mu= parms["mu"]
gamma= parms["gamma"]; N= parms["N"]
dS = mu * (N - S) - beta * S * I / N
Step1: require(deSolve) dI = beta * S * I / N - (mu + gamma) * I
Step2: gradient-function dR = gamma * I - mu * R
Step3: parameter values res=c(dS, dI, dR)

Step4: initial values list(res) }

Step5: time points


#3 paras = c(mu = 0, N = 1, beta = 2, gamma = 1/2)
Step6: call ode()-function
#4 start = c(S=0.999, I=0.001, R = 0)
#5 times = seq(0, 26, by=1/10)

#6 out = ode(y = start, times = times, func = sirmod,


https://shiny.bcgsc.ca/posepi1/
parms = paras)
Further insights 1

R0 determines

• Final epidemic size

• Time and height of peak

• The critical vaccine cover

(Endemic mean age of infection)

Together with infectious period, initial rate of exponential increase


The “open epidemic” – susceptible recruitment
> SIR.app

Further insights 2:

• Inter epidemic interval SI & SIS -> logistic invasion


SIR, SEIR, SEIRS -> epidemic invasion

• S* = 1/R0

• Endemic mean age of infection

• “Natural herd immunity” does not exist – epidemic spread will slow as immunity builds up, but in
large cities will never go extinct unless vaccination or other interventions reduce R0 below 1.
Fraction infected
Fraction

Fraction susceptible
time

• With susceptible recruitment, (dampened) epidemic cycles appear

• Inter-epidemic interval depends on


• Transmission rate
• Infectious period
• Birth rate
• (duration of immunity)

>>Shiny App
Invasion of rabies in
NE US raccoons

A simple SIR-like model


predicts 39 months
interepidemic period (9
mos) too short

1980 1985 1990 1997


ME

NY
1 Case
PA 15 Cases
30 Cases
VA

NC
Model elaborations (& R0)

• SEIR with disease induced mortality

• Scaling of transmission with density

• (Jaccibians and inter epidemic periods)

• (Next generation method)


Ottar Bjornstad – Penn State University
[email protected]

Standalone Shiny-embedded Rmarkdowns


https://github.com/objornstad/ecomodelmarkdowns

Epidemics: models and data using R:


https://github.com/objornstad/epimdr

You might also like