SWEN90004
Modelling Complex Software Systems
Lectures Cx.04
ODE Models II: Epidemics
Artem Polyvyanyy, Nic Geard
artem.polyvyanyy@unimelb.edu.au;
nicholas.geard@unimelb.edu.au
Semester 1, 2021
1 / 51
Recap
building a mathematical model
starting with a simple model
extending models to include additional aspects of real world
models:
populaton growth
species interaction (predator-prey)
representing behaviour of dynamic systems
time series plots (how system state changes over time)
phase portraits (how state variables change with respect to each
other)
exploring behaviour
numerically (using matlab or R to evaluate system) analytically (working directly with equations)
2 / 51
Objectives
explore the SIR model of infectious disease transmission
use this model to ask and answer questions
understand the difference between stochastic and deterministic
models
Questions
What level of vaccine coverage do we need to maintain to prevent measles spreading?
Given a limited supply of antiviral drugs, who should we prioritise in the next flu pandemic?
When might socially and economically disruptive interventions, such as closing schools or airports, make sense?
How can we prevent future outbreaks of a disease like Ebola?
3 / 51
Recap – model terminology
Infectious disease models are dynamic models—they describe how an infection spreads through a population over time.
A model has a state, which describes all relevant aspects of the system at a particular point in time (eg, which people are currently healthy/sick).
A model has update rules, which describe how the state of a model changes over time (eg, how healthy people become sick).
These rules often involve parameters, which can be varied to cal- ibrate the rules to a real world scenario (eg, how long it takes a typical person to recover from measles or influenza).
4 / 51
The basic SIR model
The Susceptible, Infectious, Recovered (SIR) model is one of the simplest disease models, proposed almost 100 years ago and still the basis of ID modelling today.
The SIR model sorts people into three categories based on their disease state:
Susceptible – can be infected
Infectious – can infect others
Recovered – cannot be infected nor infect others
5 / 51
The basic SIR model
If we think about a single person in our population, there are two possible events that can occur to them:
1. If they are susceptible, and they encounter an infectious person, they may be infected
2. If they are infectious, they may recover
6 / 51
A simple implementation of the basic SIR model
State: A population of N = 10 people, each with a state S, I or R. Initial condition: On day zero, 9 people are susceptible (S) and 1
is infectious (I)
t=0: [S,S,S,S,S,S,I,S,S,S]
Rules: As this is a small group of people, we’ll assume that everybody meets everybody else each day
Infection: each time a susceptible person meets an infectious person, they have a probability q of becoming infectious on the next day
Recovery: an infectious person will recover (R) on the next day with probability γ
Parameters: q and γ
7 / 51
Working out whether an event happens?
What does it mean for infection to happen with probability q = 0.2? If a susceptible person meets an infectious person, they have a 20%
chance of becoming sick.
Alternatively, for every five such contacts that occur, on average one of them will result in disease transmission occurring.
We can simulate this process in a computer by generating a random number x between 0 and 1
eg, 0.3465, 0.1989, 0.8796, . . .
If x is less than q, we will say that transmission has occurred.
8 / 51
Running our model
Do the following steps for each day:
1. Infection: Check each susceptible person X:
Check each contact between X and each infectious person Y:
pick a random number n
ifn 1, then the outbreak may take off.
25 / 51
The basic reproduction number
26 / 51
Outbreak dynamics when R0 is near 1
Parameters: N = 10, 000; β = 4 × 10−5; γ = 0.4 (1 initial infectious
person; 25 simulations)
Even with plenty of susceptible people to infect, a disease with R0 = 1 will struggle to persist.
27 / 51
Outbreak dynamics when R0 is near 1
Parameters: N = 10, 000; β = 4 × 10−5; γ = 0.4 (100 initial infec-
tious person; 25 simulations)
Outbreaks can fade out even when the initial number of infectious people is relatively large (100 people). For example, H5N1 can spread from birds to humans, but is not usually human transmissible.
28 / 51
Stochastic models summary
As our population size increases, the influence of chance diminishes. Perhaps we can ignore stochasticity altogether if our population is large enough?
When does stochasticity matter?
29 / 51
Deterministic models
An alternative to stochastic models, which generate distributions of potential outcomes, is deterministic models, which generate unique outcomes based on a given set of parameters and initial condition.
Unlike stochastic models, for each state of a deterministic model, there is only one possible future state.
If we are happy to ignore the variability in potential epidemic out- comes, we can set up a model that efficiently simulates the average behaviour of a system.
30 / 51
A deterministic version of the SIR model
State: St, It and Rt are the number of susceptible, infectious and recovered people at time t.
Rules: We use mathematical functions to specify how the state of the system at time t changes at time t + δt. By convention, we often say δt = 1 timestep, the length of which we then choose (eg, 1 day, 1 week, 6 hours, etc)
Parameters:
St+1 =St −βStIt
It+1 =It +βStIt −γIt
Rt+1 =Rt +γIt
β and γ are now the rates of effective contact (per capita) and recovery. 31 / 51
Recovery rate and duration of infection
The inverse of a rate is the average time until something occurs – so D = 1/γ is the average length of time that someone is infectious.
For example if the rate of recovery is 1/4 days then we would expect an infected person to experience one recovery every four days.
Alternatively, on any given day, we would expect 1/4 of the infected population to recover.
32 / 51
Running the deterministic SIR model – output
The mathematical equations on the previous slide can be set up very simply in a spreadsheet, or a package such as R or Matlab.
Note that, unlike the stochastic model, each time we run the deter- ministic model we get exactly the same result.
33 / 51
Difference equations and differential equations
dS = −βSI dt
dI =βSI−γI dt
dR = γI dt
Note: Models often describe the fraction of the population in each compartment; ie, S + I + R = 1
34 / 51
The basic reproduction number and outbreak size
R can also let us estimate what proportion of a population will have been infected by the end of an outbreak – the final attack rate.
35 / 51
Examples: a measles-like illness
R0 =16;γ=0.14(1/γ=7days)
36 / 51
Examples: a chicken pox-like illness
R0 =8;γ=0.14(1/γ=7days);
37 / 51
Examples: a mumps-like illness
R0 = 8; γ = 0.07 (1/γ = 14 days);
38 / 51
Examples: a smallpox-like illness
R0 = 4; γ = 0.07 (1/γ = 14 days);
39 / 51
Fitting the SIR model to data
40 / 51
Preventing outbreaks with vaccination
One way that vaccinations can protect people is by preventing them from becoming infected; this is equivalent to moving them from the S into the R compartment.
41 / 51
The basic reproduction number and vaccination
A further important property of the reproduction number is that it allows us to estimate the fraction v of the population that need to be vaccinated in order to prevent an outbreak from occurring:
v>=1− 1 R0
42 / 51
The basic reproduction number and vaccination
The coverage needed to prevent an outbreak increases with R0.
43 / 51
Vaccination
Parameters: N = 100000; R0 = 16; varying proportion of population vaccinated at t0.
44 / 51
Extending the basic SIR model—adding demography
The SIR model makes the assumption that the size and composition of the population is fixed over time: no one enters or leaves.
This assumption is appropriate for a single outbreak (eg, of influenza). It is less appropriate for looking at long term behaviour of a disease over years or decades, when death and birth will lead to most or all of the population being replaced.
45 / 51
Extending the basic SIR model—adding demography
dS =mN−βSI−mS dt
dI =βSI−γI−mI dt
dR = γI − mR dt
In this model, we assume that people are born susceptible at a rate m, and die at the same rate irrespective of their disease state, and that the size of the population will remain constant over time.
46 / 51
The SIR model with demography – output
N=100,000;R0 =16;γ=1/7;m=5.5×10−5 (=1/50years)
Note that the first y-axis has been truncated—the first outbreak peaks at ~76,000 infectious cases!
47 / 51
Caution!
Zooming in on the time period from day 4,500 to day 6,500:
48 / 51
Caution!
In this example, we saw that the number of infectious people dropped very low between each outbreak.
How big is our population?
How many people were infectious in the trough between outbreaks? If less than one person is infectious, the disease is eliminated.
But the model doesn’t know this!
49 / 51
Demography and vaccination
A more elaborate model, in which a fraction v of newborns receive immunity from vaccination:
dS =m(1−v)N−βSI−mS dt
dI =βSI−γI−mI dt
dR =mvN+γI−mR dt
50 / 51
Summary
The SIR model of infectious disease transmission Assumptions of the SIR model:
homogeneous population: everyone is the same
homogeneous mixing: everyone has the same chance of contact
Stochastic models:
more computation – more suited to small populations (or small number of infectious people)
provides information on distribution of outcomes Deterministic models:
more efficient to run – can explore more parameters
analysis can provide more general insights
only applicable when certain conditions hold (larger population,
larger number of infectious people)
51 / 51