41
Modeling frameworks Today, compare: Deterministic Compartmental Models (DCM) Stochastic Pairwise Models (SPM) for (I, SI, SIR, SIS) Rest of the week: Focus on Stochastic Network Models UW - NME 2013 1 8-13 July 2013

Modeling frameworks

  • Upload
    ruana

  • View
    44

  • Download
    0

Embed Size (px)

DESCRIPTION

Modeling frameworks. Today, compare:Deterministic Compartmental Models (DCM) Stochastic Pairwise Models (SPM) for (I, SI, SIR, SIS) R est of the week: Focus on Stochastic Network Models. Deterministic Compartmental Modeling. Susceptible. Infected. Recovered. - PowerPoint PPT Presentation

Citation preview

Page 1: Modeling  frameworks

UW - NME 2013 1

Modeling frameworks

Today, compare: Deterministic Compartmental Models (DCM)Stochastic Pairwise Models (SPM)

for (I, SI, SIR, SIS)

Rest of the week: Focus on Stochastic Network Models

8-13 July 2013

Page 2: Modeling  frameworks

UW - NME 2013 2

Deterministic Compartmental Modeling

Susceptible Infected Recovered

8-13 July 2013

Page 3: Modeling  frameworks

UW - NME 2013

• A form of dynamic modeling in which people are divided up into a limited number of “compartments.”• Compartments may differ from each other on any variable that is of epidemiological relevance (e.g. susceptible vs. infected, male vs. female).• Within each compartment, people are considered to be homogeneous, and considered only in the aggregate.

Compartmental Modeling

Compartment 1

38-13 July 2013

Page 4: Modeling  frameworks

UW - NME 2013

• People can move between compartments along “flows”. • Flows represent different phenomena depending on the compartments that they connect• Flow can also come in from outside the model, or move out of the model• Most flows are typically a function of the size of compartments

Compartmental Modeling

Susceptible Infected

48-13 July 2013

Page 5: Modeling  frameworks

UW - NME 2013

• May be discrete time or continuous time: we will focus on discrete• The approach is usually deterministic – one will get the exact same results from a model each time one runs it• Measures are always of EXPECTED counts – that is, the average you would expect across many different stochastic runs, if you did them• This means that compartments do not have to represent whole numbers of people.

58-13 July 2013

Compartmental Modeling

Page 6: Modeling  frameworks

UW - NME 2013

Constant-growth model

Infected population

t = timei(t) = expected number of infected people at time tk = average growth (in number of people) per time period

68-13 July 2013

Page 7: Modeling  frameworks

UW - NME 2013

recurrence equation

difference equation(three different notations for the same concept – keep all in mind when reading the literature!)

7

𝑖 (𝑡+1 )=𝑖 (𝑡 )+𝑘𝑖 (𝑡+1 )−𝑖 (𝑡 )=𝑘𝑑𝑖/𝑑𝑡=𝑘∆ 𝑖=𝑘

𝑖 (𝑡+2 )=𝑖 (𝑡+1 )+𝑘𝑖 (𝑡+2 )=𝑖 (𝑡 )+𝑘+𝑘

𝑖 (𝑡+1 )=𝑖 (𝑡 )+𝑘

𝑖 (𝑡+2 )=𝑖 (𝑡 )+2𝑘

𝑖 (𝑡+3 )=𝑖 (𝑡+2 )+𝑘𝑖 (𝑡+3 )=𝑖 (𝑡 )+2𝑘+𝑘𝑖 (𝑡+3 )=𝑖 (𝑡 )+3𝑘

𝑖 (𝑡+𝑥 )=𝑖 (𝑡 )+𝑥𝑘8-13 July 2013

Constant-growth model

Page 8: Modeling  frameworks

UW - NME 2013

Example: Constant-growth modeli(0) = 0; k = 7

0.00

20.00

40.00

60.00

80.00

100.00

120.00

140.00

160.00

0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48

Time

Com

part

men

t Siz

e

88-13 July 2013

Page 9: Modeling  frameworks

UW - NME 2013

Proportional growth model

Infected population

t = timei(t) = expected number of infected people at time tr = average growth rate per time period

recurrence equation

difference equation

9

𝑖 (𝑡+1 )=𝑖 (𝑡 )+𝑟𝑖(𝑡)𝑖 (𝑡+1 )−𝑖 (𝑡 )=𝑟𝑖(𝑡)𝑖 (𝑡+𝑥 )=𝑖(𝑡 )(1+𝑟 )𝑥

8-13 July 2013

Page 10: Modeling  frameworks

UW - NME 2013

Example: Proportional-growth modeli(1) = 1; r = 0.3

108-13 July 2013

Page 11: Modeling  frameworks

UW - NME 2013

Susceptible Infected

New infections per unit time (incidence)

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t

What is the expected incidence per unit time?

118-13 July 2013

SI model

Page 12: Modeling  frameworks

UW - NME 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

Expected incidence at time t

12

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t

8-13 July 2013

SI model

Page 13: Modeling  frameworks

UW - NME 2013

SI model

Expected incidence at time t

13

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t

8-13 July 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

Page 14: Modeling  frameworks

UW - NME 2013

SI model

Expected incidence at time t

14

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t = act rate per unit time

8-13 July 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

Page 15: Modeling  frameworks

UW - NME 2013

Expected incidence at time t

15

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t = act rate per unit time

8-13 July 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

SI model

Page 16: Modeling  frameworks

UW - NME 2013

SI model

Expected incidence at time t

16

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t = act rate per unit time = “transmissibility” = prob. of transmission given S-I act

8-13 July 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

Page 17: Modeling  frameworks

UW - NME 2013

SI model

Expected incidence at time t

17

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t = act rate per unit time = “transmissibility” = prob. of transmission given S-I actn(t) = total population = s(t) + i(t)

8-13 July 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

Page 18: Modeling  frameworks

UW - NME 2013

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time t = act rate per unit time = “transmissibility” = prob. of transmission given S-I actn(t) = total population = s(t) + i(t) = n

Careful: only because this is a “closed” population

SI model

Expected incidence at time t

188-13 July 2013

A new infection requires: a susceptible person to have an act with an infected person and for infection to transmit because of that act

Page 19: Modeling  frameworks

UW - NME 2013

Susceptible Infected

What does this mean for our system of equations?

Expected incidence at time t

19

8-13 July 2013

SI model

Page 20: Modeling  frameworks

UW - NME 2013

Susceptible Infected

What does this mean for our system of equations?

Expected incidence at time t

𝑠 (𝑡+1 )=𝑠 (𝑡 )−𝑠 (𝑡 )𝛼 𝑖 (𝑡 )𝑛 𝜏

𝑖 (𝑡+1 )=𝑖 (𝑡 )+𝑠 (𝑡 )𝛼 𝑖 (𝑡 )𝑛 𝜏

20

8-13 July 2013

SI model

Page 21: Modeling  frameworks

UW - NME 2013

Remember:

constant-growth model could be expressed as:

proportional-growth model could be expressed as:

SI model - Recurrence equations

21

𝑖 (𝑡+𝑥 )=𝑖 (𝑡 )+𝑥𝑘

𝑖 (𝑡+𝑥 )=𝑖(𝑡)(1+𝑟 )𝑥

The SI model is very simple, but already too difficult to express as a simple recurrence equation.

Solving iteratively by hand (or rather, by computer) is necessary

8-13 July 2013

Page 22: Modeling  frameworks

UW - NME 2013 22

Susceptible Infected

SIR model

t = times(t) = expected number of susceptible people at time ti(t) = expected number of infected people at time tr(t) = expected number of recovered people at time t = act rate per unit time = prob. of transmission given S-I actr = recovery rate

Recovered

What if infected people can recover with immunity?

And let us assume they all do so at the same rate:

8-13 July 2013

Page 23: Modeling  frameworks

UW - NME 2013 23

Relationship between duration and recovery rateImagine that a disease has a constant recover rate of 0.2. That is, on the first day of infection, you have a 20% probability of recovering. If you don’t recover the first day, you then have a 20% probability of recovering on Day 2. Etc.

Now, imagine 100 people who start out sick on the same day.

• How many recover after being infected 1 day?• How many recover after being infected 2 days?• How many recover after being infected 3 days?• What does the distribution of time spent infected look like?• What is this distribution called?• What is the mean (expected) duration spent sick?

8-13 July 2013

100*0.2 = 20 80*0.2 = 16 64*0.2 = 12.8Right-tailedGeometric5 days ( = 1/.2)D = 1/ r

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 3305

10152025

Page 24: Modeling  frameworks

UW - NME 2013 24

Expected number of new infections at time t still equals

where n now equals

Expected number of recoveries at time t equals

So full set of equations equals:

SIR model

𝑠 (𝑡+1 )=𝑠 (𝑡 )−𝑠 (𝑡 )𝛼 𝑖 (𝑡 )𝑛 𝜏

𝑖 (𝑡+1 )=𝑖 (𝑡 )+𝑠 (𝑡 )𝛼 𝑖 (𝑡 )𝑛 𝜏− 𝜌 𝑖 (𝑡 )

𝑟 (𝑡+1 )=𝑟 (𝑡 )+𝜌 𝑖 (𝑡 )

8-13 July 2013

Page 25: Modeling  frameworks

UW - NME 2013 25

SIR model = 0.6, = 0.3, = 0.1

Initial population sizes s(0)=299; i(0)=1; r(0) = 0

susceptible

infected

recovered

What happens on Day 62? Why?

8-13 July 2013

Page 26: Modeling  frameworks

UW - NME 2013 26

R0 = the number of direct infections occurring as a result of a single infection in a susceptible population – that is, one that has not experienced the disease before

We saw earlier that R0 = . So for the basic SIR model, it also equals /

Tells one whether an epidemic is likely to occur or not:

• If R0 > 1, then a single infected individual in the population will on average infect more than one person before ceasing to be infected. In a deterministic model, the disease will grow

• If R0 < 1, then a single infected individual in the population will on average infect less than one person before ceasing to be infected. In a deterministic model, the disease will fade away

• If R0 = 1, we are right on the threshold between an epidemic and not. In a deterministic model, the disease will putter along

Qualitative analysis pt 1:Epidemic potential

Using the SIR model

8-13 July 2013

Page 27: Modeling  frameworks

UW - NME 2013 27

SIR model = 4, = 0.2, = 0.2

Initial population sizes s(0)=999; i(0)=1; r(0) = 0

R0 = / = (4)(0.2)/(0.2) = 4

Compartment sizes Flow sizes

SusceptibleInfectedRecovered

Transmissions (incidence)Recoveries

8-13 July 2013

Page 28: Modeling  frameworks

UW - NME 2013 28

SIR model = 4, = 0.2, = 0.8

Initial population sizes s(0)=999; i(0)=1; r(0) = 0

R0 = /= (4)(0.2)/(0.8) = 1

Compartment sizes Flow sizes

SusceptibleInfectedRecovered

Transmissions (incidence)Recoveries

8-13 July 2013

Page 29: Modeling  frameworks

UW - NME 2013 29

Susceptible Infected

SIR model with births and deaths

t = times(t) = number of susceptible people at time ti(t) = number of infected people at time tr(t) = number of recovered people at time t = act rate per unit time = prob. of transmission given S-I actr = recovery ratef = fertility ratems = mortality rate for susceptiblesmi = mortality rate for infectedsmr = mortality rate for recovereds

Recoveredbirth

death death death

trans. recov.

8-13 July 2013

Page 30: Modeling  frameworks

UW - NME 2013 30

Stochastic Pairwise models (SPM)

8-13 July 2013

Page 31: Modeling  frameworks

UW - NME 2013 31

Basic elements of the stochastic model

• System elements– Persons/animals, pathogens, vectors

• States– properties of elements

As before, but

• Transitions– Movement from one state to another: Probabilistic

8-13 July 2013

Page 32: Modeling  frameworks

UW - NME 2013 32

Deterministic vs. stochastic modelsSimple example: Proportional growth model

– States: only I is tracked, population has an infinite number of susceptibles– Rate parameters: only , the force of infection (𝛽 b = ta)

Deterministic Stochastic

Incidence(new cases)

Incident infections are determined by the force of

infection

Incident infections are drawn from a probability distribution

that depends on

8-13 July 2013

Page 33: Modeling  frameworks

UW - NME 2013 33

What does this stochastic model mean?

Depends on the model you choose for P(●)

P(●) is a probability distribution.– Probability of what? … that the count of new infections dI = k at time t– So what kind of distributions are appropriate? … discrete distributions– Can you think of one?

Example: Poisson distribution• Used to model the number of events in a set amount of time or space• Defined by one parameter: it is the both the mean and the variance• Range: 0,1,2,… (the non-negative integers)• The pmf is given by:

𝑃 (𝑑𝐼 𝑡=𝑘|𝛽 , 𝐼𝑡 ,𝑑𝑡 ¿

P(X=k) =

8-13 July 2013

Page 34: Modeling  frameworks

UW - NME 2013 34

How does the stochastic model capture transmission?

The effect of l on a Poisson distribution

Mean: E(dIt)=lt

Variance: Var(dIt)=lt

If we specify: lt = b It dt

Then: E(dIt)= b It dt , the deterministic model rate

P(dIt=k) =

8-13 July 2013

Page 35: Modeling  frameworks

UW - NME 2013 35

What do you get for this added complexity?

• Variation – a distribution of potential outcomes– What happens if you all run a deterministic model with the same parameters?– Do you think this is realistic?

• Recall the poker chip exercises • Did you all get the same results when you ran the SI model?• Why not?

• Easier representation of all heterogeneity, systematic and stochastic– Act rates– Transmission rates– Recovery rates, etc…

• When we get to modeling partnerships: – Easier representation of repeated acts with the same person– Networks of partnerships

8-13 July 2013

Page 36: Modeling  frameworks

UW - NME 2013 36

Example: A simple stochastic model programmed in R

• First we’ll look at the graphical output of a model

• … then we’ll take a peek behind the curtain

8-13 July 2013

Page 37: Modeling  frameworks

UW - NME 2013 37

Behind the curtain: a simple R code for this model

# First we set up the components and parameters of the system

steps <- 70 # the number of simulation stepsdt <- 0.01 # step size in time units

total time elapsed is then steps*dt

i <- rep(0,steps) # vector to store the number of infected at time(t)di <- rep(0,steps) # vector to store the number of new infections at

time(t)i[1] <- 1 # initial prevalence

beta <- 5 # beta = alpha (act rate per unit time) * # tau (transmission probability given act)

8-13 July 2013

Page 38: Modeling  frameworks

UW - NME 2013 38

# Now the simulation: we simulate each step through time by drawing the# number of new infections from the Poisson distribution

for(k in 1:(steps-1)){

di[k] <- rpois(n=1, lambda=beta*i[k]*dt)

i[k+1] <- i[k] + di[k]

}

In words:

For t-1 steps (for(k in 1:(steps-1))) Start of instructions ( { )

new infections at step t <- randomly draw from Poisson (rpois) di[k] one observation (n=1) with this mean (lambda= … )

update infections at step t+1 <- infections at (t) + new infections at (t) i[k+1] i[k] ni[k]

End of instructions ( } )

Behind the curtain: a simple R code for this model

lt = b It dt

8-13 July 2013

Page 39: Modeling  frameworks

UW - NME 2013 39

The stochastic-deterministic relation• Will the stochastic mean equal the deterministic mean?

– Yes, but only for the linear model– The variance of the empirical stochastic mean depends on the number of

replications

• Can you represent variation in deterministic simulations?– In a limited way

• Sensitivity analysis shows how outcomes depend on parameters• Parameter uncertainty can be incorporated via Bayesian methods• Aggregate rates can be drawn from a distribution (in Stella and Excel)

– But micro-level stochastic variation can not be represented.

• Will stochastic variation always be the same?– No, can specify many different distributions with the same mean

• Poisson• Negative binomial• Geometric …

– The variation depends on the probability distribution specified8-13 July 2013

Page 40: Modeling  frameworks

UW - NME 2013 40

To EpiModel…

8-13 July 2013

Page 41: Modeling  frameworks

UW - NME 2013 41

ˆ( ) 0i t is required by condition 3, and also satisfies conditions 1 and 2

Without new people entering the population, the epidemic will always die out eventually.

Note that s(t) and r(t) can thus take on different values at equilibrium

alsowritten

as

Appendix:Finding equilibria

Using the SIR model without birth and death

𝑠 (𝑡+1 )=𝑠 (𝑡 )−𝑠 (𝑡 )𝑐 𝑖 (𝑡 )𝑛 𝜏

𝑖 (𝑡+1 )=𝑖 (𝑡 )+𝑠 (𝑡 )𝑐 𝑖 (𝑡 )𝑛 𝜏−𝑣𝑖 (𝑡 )

𝑟 (𝑡+1 )=𝑟 (𝑡 )+𝑣𝑖 (𝑡 )

𝑑𝑠𝑑𝑡=−𝑠 (𝑡 )𝑐 𝑖 (𝑡 )

𝑛 𝜏

𝑑𝑖/𝑑𝑡=𝑠 (𝑡 )𝑐 𝑖 (𝑡 )𝑛 𝜏−𝑣𝑖 (𝑡 )

𝑑𝑟 /𝑑𝑡=𝑣𝑖 (𝑡 )

0=−𝑠 (𝑡 )𝑐 𝑖 (𝑡 )𝑛 𝜏

0=𝑠 (𝑡 )𝑐 𝑖 (𝑡 )𝑛 𝜏−𝑣𝑖 (𝑡 )

0=𝑣𝑖 (𝑡 )

�̂� (𝑡 )=0 �̂� (𝑡 )=0or

�̂� (𝑡 )=𝑣𝑛/𝑐 𝛽 �̂� (𝑡 )=0or

�̂� (𝑡 )=0

8-13 July 2013