CS代考 Modelling Complex Software Systems

Modelling Complex Software Systems
Lectures Cx.04
ODE Models II: Epidemics
Artem Polyvyanyy,

Copyright By PowCoder代写 加微信 powcoder

Semester 1, 2022

􏰁 building a mathematical model
􏰁 starting with a simple model
􏰁 extending models to include additional aspects of real world
􏰁 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
􏰁 exploring behaviour
􏰁 numerically (using matlab or R to evaluate system) 􏰁 analytically (working directly with equations)

Objectives
􏰁 explore the SIR model of infectious disease transmission
􏰁 use this model to ask and answer questions
􏰁 understand the difference between stochastic and deterministic
􏰁 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?

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).

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

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

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 γ

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.

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.

The basic reproduction number

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.

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.

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?

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.

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.

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.

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

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.

Examples: a measles-like illness
R0 =16;γ=0.14(1/γ=7days)

Examples: a chicken pox-like illness
R0 =8;γ=0.14(1/γ=7days);

Examples: a mumps-like illness
R0 = 8; γ = 0.07 (1/γ = 14 days);

Examples: a smallpox-like illness
R0 = 4; γ = 0.07 (1/γ = 14 days);

Fitting the SIR model to data

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.

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

The basic reproduction number and vaccination
The coverage needed to prevent an outbreak increases with R0.

Vaccination
Parameters: N = 100000; R0 = 16; varying proportion of population vaccinated at t0.

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.

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.

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!

Zooming in on the time period from day 4,500 to day 6,500:

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!

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

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)

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com