Stochastic modelling of epidemic spread

Similar documents
Stochastic modelling of epidemic spread

An Introduction to Stochastic Epidemic Models

AN INTRODUCTION TO STOCHASTIC EPIDEMIC MODELS-PART I

Stochastic process. X, a series of random variables indexed by t

Irreducibility. Irreducible. every state can be reached from every other state For any i,j, exist an m 0, such that. Absorbing state: p jj =1

MARKOV PROCESSES. Valerio Di Valerio

AARMS Homework Exercises

2. Transience and Recurrence

The SIS and SIR stochastic epidemic models revisited

Markov Chains, Stochastic Processes, and Matrix Decompositions

Thursday. Threshold and Sensitivity Analysis

LIMITING PROBABILITY TRANSITION MATRIX OF A CONDENSED FIBONACCI TREE

Outlines. Discrete Time Markov Chain (DTMC) Continuous Time Markov Chain (CTMC)

Derivation of Itô SDE and Relationship to ODE and CTMC Models

Statistics 992 Continuous-time Markov Chains Spring 2004

Stochastic processes. MAS275 Probability Modelling. Introduction and Markov chains. Continuous time. Markov property

Transmission in finite populations

Lecture 20 : Markov Chains

6 Continuous-Time Birth and Death Chains

Stochastic2010 Page 1

Lecture 11: Introduction to Markov Chains. Copyright G. Caire (Sample Lectures) 321

Example: physical systems. If the state space. Example: speech recognition. Context can be. Example: epidemics. Suppose each infected

Copyright is owned by the Author of the thesis. Permission is given for a copy to be downloaded by an individual for the purpose of research and


APM 541: Stochastic Modelling in Biology Discrete-time Markov Chains. Jay Taylor Fall Jay Taylor (ASU) APM 541 Fall / 92

Markov Processes Hamid R. Rabiee

Convex Optimization CMU-10725

Markov Chains. X(t) is a Markov Process if, for arbitrary times t 1 < t 2 <... < t k < t k+1. If X(t) is discrete-valued. If X(t) is continuous-valued

Markov Chains CK eqns Classes Hitting times Rec./trans. Strong Markov Stat. distr. Reversibility * Markov Chains

Section 9.2: Matrices. Definition: A matrix A consists of a rectangular array of numbers, or elements, arranged in m rows and n columns.

CDA6530: Performance Models of Computers and Networks. Chapter 3: Review of Practical Stochastic Processes

Part I Stochastic variables and Markov chains

Lecture 20: Reversible Processes and Queues

STOCHASTIC PROCESSES Basic notions

Perron Frobenius Theory

Probability Distributions

SMSTC (2007/08) Probability.

Lecture 21. David Aldous. 16 October David Aldous Lecture 21

6.207/14.15: Networks Lectures 4, 5 & 6: Linear Dynamics, Markov Chains, Centralities

MATH 56A: STOCHASTIC PROCESSES CHAPTER 1

Discrete Time Markov Chain of a Dynamical System with a Rest Phase

Three Disguises of 1 x = e λx

Homework 4 due on Thursday, December 15 at 5 PM (hard deadline).

Probability Distributions

IEOR 6711, HMWK 5, Professor Sigman

8. Statistical Equilibrium and Classification of States: Discrete Time Markov Chains

18.175: Lecture 30 Markov chains

Mean-field dual of cooperative reproduction

Introduction to SEIR Models

Math Homework 5 Solutions

Availability. M(t) = 1 - e -mt

IEOR 6711: Professor Whitt. Introduction to Markov Chains

Definition A finite Markov chain is a memoryless homogeneous discrete stochastic process with a finite number of states.

Recap. Probability, stochastic processes, Markov chains. ELEC-C7210 Modeling and analysis of communication networks

The Transition Probability Function P ij (t)

No class on Thursday, October 1. No office hours on Tuesday, September 29 and Thursday, October 1.

Probability, Random Processes and Inference

2 Discrete-Time Markov Chains

Epidemics in Networks Part 2 Compartmental Disease Models

1.3 Convergence of Regular Markov Chains

Markov Chains. As part of Interdisciplinary Mathematical Modeling, By Warren Weckesser Copyright c 2006.

Matrix analytic methods. Lecture 1: Structured Markov chains and their stationary distribution

IEOR 6711: Stochastic Models I Professor Whitt, Thursday, November 29, Weirdness in CTMC s

Birth and Death Processes. Birth and Death Processes. Linear Growth with Immigration. Limiting Behaviour for Birth and Death Processes

Nonnegative Matrices I

Lecture 15 Perron-Frobenius Theory

Stochastic Models. John M. Drake & Pejman Rohani

Markov Chains and Stochastic Sampling

Section 9.2: Matrices.. a m1 a m2 a mn

Data analysis and stochastic modeling

Markov Chains and Pandemics

Introduction to Machine Learning CMU-10701

Social network analysis: social learning

System theory and system identification of compartmental systems Hof, Jacoba Marchiena van den

Let (Ω, F) be a measureable space. A filtration in discrete time is a sequence of. F s F t

Markov Chains, Random Walks on Graphs, and the Laplacian

Statistics 253/317 Introduction to Probability Models. Winter Midterm Exam Monday, Feb 10, 2014

Markov Chains Absorption (cont d) Hamid R. Rabiee

10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections )

1 Stochastic Dynamic Programming

Markov chains. Randomness and Computation. Markov chains. Markov processes

Finite-Horizon Statistics for Markov chains

Censoring Technique in Studying Block-Structured Markov Chains

Markov chains. 1 Discrete time Markov chains. c A. J. Ganesh, University of Bristol, 2015

The Theory behind PageRank

Markov-modulated interactions in SIR epidemics

Lectures on Markov Chains

Markov Model. Model representing the different resident states of a system, and the transitions between the different states

Numerical solution of stochastic epidemiological models

An Introduction to Entropy and Subshifts of. Finite Type

(b) What is the variance of the time until the second customer arrives, starting empty, assuming that we measure time in minutes?

LAW OF LARGE NUMBERS FOR THE SIRS EPIDEMIC

Modelling in Systems Biology

LTCC. Exercises solutions

STAT STOCHASTIC PROCESSES. Contents

Math 443/543 Graph Theory Notes 5: Graphs as matrices, spectral graph theory, and PageRank

Statistics 150: Spring 2007

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

CDA5530: Performance Models of Computers and Networks. Chapter 3: Review of Practical

STA 624 Practice Exam 2 Applied Stochastic Processes Spring, 2008

Transcription:

Stochastic modelling of epidemic spread Julien Arino Department of Mathematics University of Manitoba Winnipeg Julien Arino@umanitoba.ca 19 May 2012

1 Introduction 2 Stochastic processes 3 The SIS model used as an example 4 DTMC 5 CTMC

1 Introduction 2 Stochastic processes 3 The SIS model used as an example 4 DTMC 5 CTMC

Deterministic SIR Use the standard KMK as in Fred s lectures: S 0 = SI I 0 = SI I R 0 = I Basic reproduction number R 0 = S 0 If R 0 < 1, no outbreak If R 0 > 1, outbreak Use =1/4, N = S + I + R = 100, I (0) = 1, R 0 = {0.5, 1.5} and so that this is true

R 0 =0.5 R 0 =1.5 100 100 S S 90 I 90 I R R 80 80 70 60 50 40 30 20 10 70 60 50 40 30 20 10 0 0 50 100 150 Time (days) 1 0 0 50 100 150 Time (days) 8 0.9 7 0.8 6 Number infectious 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Number infectious 5 4 3 2 1 0 0 50 100 150 Time (days) 0 0 50 100 150 Time (days)

Stochastic DTMC SIR Consider S(t) andi (t) (R(t) = N S(t) I (t)). Define transition probabilities p (s 0,i 0 ),(s,i)( t) = P{(S(t + t), I (t + t)) = (s + s 0, i + i 0 ) (S(t), I (t)) = (s, i)} by 8 si t (s 0, i 0 )=( 1, 1) >< i t (s 0, i 0 )=(0, 1) p (s 0,i 0 ),(s,i)( t) = 1 [ si + i] t (s 0, i 0 )=(0, 0) >: 0 otherwise Parameters as previously and t = 0.01

7 R 0 =0.5 R 0 =1.5 25 6 5 20 Number infectious 4 3 Number infectious 15 10 2 5 1 0 0 50 100 150 Time (days) 0 0 50 100 150 Time (days) 1.4 3.5 1.2 3 1 2.5 Number infectious 0.8 0.6 Number infectious 2 1.5 0.4 1 0.2 0.5 0 0 50 100 150 Time (days) 0 0 50 100 150 Time (days)

1000 Number of outbreaks 900 Number of simulations with an outbreak (/1000) 800 700 600 500 400 300 200 100 R 0 =0.5 R 0 =1.5 0 0 10 20 30 40 50 60 70 80 90 100 Value of I 0 outbreak: 9t s.t. I (t) > I (0)

Why stochastic models? Important to choose right type of model for given application Deterministic models Mathematically easier Perfect reproducibility For given parameter set, one sim su ces Stochastic models Often harder Each realization di erent Needs many simulations In early stage of epidemic, very few infective individuals: Deterministic systems: behaviour entirely governed by parameters Stochastic systems: allows chance to play a role

In the context of the SIR model Deterministic R 0 strict threshold R 0 < 1 ) I (t)! 0 monotonically R 0 > 1 ) I (t)! 0 after a bump (outbreak) Stochastic R 0 threshold for mean R 0 < 1 ) I (t)! 0 monotonically (roughly) on average but some realizations have outbreaks R 0 > 1 ) I (t)! 0 after a bump on average (outbreak) but some realizations have no outbreaks

1 Introduction 2 Stochastic processes 3 The SIS model used as an example 4 DTMC 5 CTMC

Theoretical setting of stochastic processes Stochastic processes form a well defined area of probability, a subset of measure theory, itself a well established area of mathematics Strong theoretical content Very briefly presented here for completeness, will not be used in what follows Used here: A. Klemke, Probability Theory, Springer 2008 DON T PANIC!!!

-algebras Definition 1 ( -algebra) Let 6= ; be a set and A 2, the set of all subsets of, bea class of subsets of. A is called a -algebra if: 1 2 A 2 A is closed under complements, i.e., A c := \ A 2 A for any A 2 A 3 A is closed under countable unions, i.e., [ 1 n=1 A n 2 A for any choice of countably many sets A 1, A 2,...2 A is the space of all elementary events and A the system of observable events

Probability space Definition 2 1 Apair(, A), with a nonempty set and A 2 a -algebra is a measurable space, withsetsa 2 A measurable sets. If is at most countably infinite and if A =2,thenthemeasurablespace(, 2 )isdiscrete 2 Atriple(, A,µ)isameasure space if (, A) isa measurable space and µ is a measure on A 3 If in addition, µ( ) = 1, then (, A,µ)isaprobability space and the sets A 2 A are events. µ is then usually denoted P (or Prob)

Topological spaces and Borel Definition 3 (Topology) -algebras Let 6= ; be an arbitrary set. A class of sets is a topology on if: 1 ;, 2 2 A \ B 2 for any A, B 2 3 ([ A2F A) 2 for any F 2 (, ) isatopological space, setsa 2 are open and A 2 with A c 2 are closed Definition 4 (Borel -algebra) Let (, ) be a topological space. The -algebra B(, ) generated by the open sets is the Borel -algebra on, with elements A 2 B(, ) theborel sets

Polish spaces Definition 5 A separable topological space whose topology is induced by a complete metric is a Polish space R d, Z d, R N,(C([0, 1]), k k 1 ) are Polish spaces

Stochastic process Definition 6 (Stochastic process) Let (, F, P) be a probability space, (E, ) be a Polish space with Borel -algebra E and T R be arbitrary (typically, T = N, T = Z, T = R + or T an interval). A family of random variables X =(X t, t 2 T ) on (, F, P) with values in (E, E) iscalledastochastic process with index set (or time set) T and range E.

OKAY, DONE WITH HARD THEORY!!!

Types of processes So a stochastic process is a collection of random variables (r.v.) {X (t,!), t 2 T,! 2 } The index set T and r.v. can be discrete or continuous Discrete time Markov chain (DTMC) hast and X discrete (e.g., T = N and X (t) 2 N) Continuous time Markov chain (CTMC) hast continuous and X discrete (e.g., T = R + and X (t) 2 N) In this course, we focus on these two. Also exist Stochastic di erential equations (SDE), with both T and X (t) continuous

Definition 7 (Markov property) Markov property Let E be a Polish space with Borel -algebra B(E), T R and (X t ) t2t an E-valued stochastic process. Assume that (F t ) t2t = (X ) is the filtration generated by X. X has the Markov property if for every A 2 B(E) andalls, t 2 T with s apple t, P[X t 2 A F s ]=P[X t 2 A X s ] Theorem 8 (The usable one) If E is countable then X has the Markov property if for all n 2 N, all s 1 < < s n < tandalli 1,...,i n, i 2 Ewith P[X s1 = i 1,...,X sn = i n ] > 0, there holds P[X t = i X s1 = i 1,...,X sn = i n ]=P[X t = i X sn = i n ]

1 Introduction 2 Stochastic processes 3 The SIS model used as an example 4 DTMC 5 CTMC

SIS model We consider an SIS model with demography. In ODE, S 0 = b ds SI + I I 0 = SI ( + d)i Total population N 0 = b dn asymptotically constant (N(t)! b/d =: N as t!1). Can work with asymptotically autonomous system where N = N (and S = N I )

S 0 = b SI ds + I I 0 = SI ( + d)i DFE: (S, I )=(b/d, 0). EEP: (S, I )= +d, b d +d VdD&W: F = D I [ S] DFE = N, V = D I [( + d)i ] DFE = + d ) R 0 = (FV 1 )= + d N If R 0 < 1, lim t!1 (S(t), I (t)) = (N, 0) If R 0 > 1, lim t!1 (S(t), I (t)) = N R 0, N N R 0

Reduction to one equation As N is asymptotically constant, we can write S = N only need I 0 = (N I )I ( + d)i I and so We can then reconstruct dynamics of S from that of I

1 Introduction 2 Stochastic processes 3 The SIS model used as an example 4 DTMC 5 CTMC

Discrete time Markov chain Definition 9 (DTMC Simple definition) An experiment with finite number of possible outcomes S 1,...,S N is repeated. The sequence of outcomes is a discrete time Markov chain if there is a set of N 2 numbers {p ij } such that the conditional probability of outcome S j on any experiment given outcome S i on the previous experiment is p ij,i.e.,for1apple i, j apple N, t =1,..., p ji =Pr(S j on experiment t +1 S i on experiment t). The outcomes S 1,...,S N are the states, andthep ij are the transition probabilities. ThematrixP =[p ij ]isthetransition matrix.

Homogeneity One major distinction: If p ij does not depend on t, thechainishomogeneous If p ij (t), i.e, transition probabilities depend on t, thechainis nonhomogeneous

Markov chains operate on two level: Description of probability that the system is in a given state Description of individual realizations of the process Because we assume the Markov property, we need only describe how system switches (transitions) from one state to the next We say that the system has no memory, thenextstatedepends only on the current one

States The states are here the di erent values of I. I can take integer values from 0 to N The chain links these states Infection Infection Infection I=0 I=1 I=2 I=3 I=N-1 I=N Recovery or Death Recovery or Death Recovery or Death Recovery or Death

Probability vector Let p i (t) =P(I (t) =i) is the probability distribution We must have P i p i(t) =1 0 1 p 0 (t) p 1 (t) p(t) = B C @. A p N (t) Initial condition at time t = 0: p(0)

Transition probabilities We then need description of probability of transition In general, suppose that S i is the current state, then one of S 1,...,S N must be the next state. If then we must have p ji = P{X (t + 1) = S j X (t) =S i } p i1 + p i2 + + p in =1, 1 apple i apple N Some of the p ij can be zero

Transition matrix The matrix 0 1 p 11 p 12 p 1N P = Bp 21 p 22 p 2N C @ A p N1 p N2 p NN has nonnegative entries, p ij 0 entries less than 1, p ij apple 1 column sum 1, which we write NX p ij =1, i=1 j =1,...,N or, using the notation 1l =(1,...,1) T, 1l T P = 1l T

In matrix form p(t + 1) = Pp(t), t =1, 2, 3,... where p(t) =(p 1 (t), p 2 (t),...,p N (t)) T is a (column) probability vector and P =(p ij )isan N transition matrix, 0 1 p 11 p 12 p 1N P = Bp 21 p 22 p 2N C @ A p N1 p N2 p NN

Stochastic matrices Definition 10 (Stochastic matrix) The nonnegative N N matrix M is stochastic if P N i=1 a ij =1for all j =1, 2,...,N. In other words, 1l T M = 1l T Theorem 11 Let M be a stochastic matrix M. Then the spectral radius (M) apple 1, i.e., all eigenvalues of M are such that apple 1. Furthermore, =1is an eigenvalue of M M has all column sums 1, 1l T M = 1l T e.value of M with associated left e.vector v, v T M = v T ) 1l T M = 1l T :lefte.vector1l T and e.value 1..

Long time behavior Let p(0) be the initial distribution (column) vector. Then p(1) = Pp(0) p(2) = Pp(1) = P(Pp(0)) = P 2 p(0) Iterating, we get that for any t 2 N, Therefore, lim p(t) = t!+1 p(t) =P t p(0) lim t!+1 Pt p(0) = lim t!+1 Pt p(0) if this limit exists (it does if P is constant and chain is regular)

Regular Markov chain Regular Markov chains not covered here, as most chains in the demographic context are absorbing. For information, though.. Definition 12 (Regular Markov chain) A regular Markov chain is one in which P k is positive for some integer k > 0, i.e., P k has only positive entries, no zero entries. Theorem 13 If P is the transition matrix of a regular Markov chain, then 1 the powers P t approach a stochastic matrix W, 2 each column of W is the same (column) vector w =(w 1,...,w N ) T, 3 the components of w are positive. So if the Markov chain is regular, lim p(t) =Wp(0) t!+1

Interesting properties of matrices Definition 14 (Irreducibility) The square nonnegative matrix M is reducible if there exists a permutation matrix P such that P T MP is block triangular. If M is not reducible, then it is irreducible Definition 15 (Primitivity) A nonnegative matrix M is primitive if and only if there is an integer k > 0 such that M k is positive

Definition 16 (Digraph) Directed graphs (digraphs) A directed graph (or digraph) G =(V, A) consists in a set V of vertices and a set A of arcs linking these vertices 5 1 2 3 4

Connecting graphs and matrices Adjacency matrix M has m ij = 1 if arc from vertex j to vertex i, 0 otherwise 1 2 3 4 5 0 1 0 1 0 0 0 1 0 0 0 0 ) M = B1 0 0 1 0 C @ 0 1 0 1 0A 0 0 0 0 0 Column of zeros (except maybe diagonal entry): vertex is a sink (nothing leaves)

Paths of length exactly 2 Given adjacency matrix M, M 2 has number of paths of length exactly two between vertices 1 2 3 4 5 0 1 1 0 0 0 0 ) M 2 0 1 0 0 0 = B0 2 0 1 0 C @ 0 0 0 1 0A 0 0 0 0 0 Write m k ij the (i, j) entryinm k m 2 32 =2since2! 1! 3and2! 4! 3..

Connecting matrices, graphs and regular chains Theorem 17 A matrix M is irreducible i the associated connection graph is strongly connected, i.e.,thereisapathbetweenanypair(i, j) of vertices Irreducibility: 8i, j, 9k, m k ij > 0 Theorem 18 A matrix M is primitive if it is irreducible and there is at least one positive entry on the diagonal of M Primitivity: 9k, 8i, j, m k ij > 0 Theorem 19 Markov chain regular, transition matrix P primitive

Strong connectedness (1) 1 7 2 4 5 3 6 8 Not strongly connected

Strong connectedness (2) 1 7 2 4 5 3 6 8 Strongly connected

Strong components 1 7 2 4 5 3 6 8 Strong component 1 Strong component 2

Absorbing states, absorbing chains Definition 20 AstateS i in a Markov chain is absorbing if whenever it occurs on the n th generation of the experiment, it then occurs on every subsequent step. In other words, S i is absorbing if p ii =1and p ij =0fori 6= j Definition 21 A Markov chain is said to be absorbing if it has at least one absorbing state, and if from every state it is possible to go to an absorbing state In an absorbing Markov chain, a state that is not absorbing is called transient

Here, we focus on absorbing strong components containing only one vertex Absorbing strong components 1 7 2 4 5 3 6 8 Absorbing strong component Transient states

Some questions on absorbing chains 1 Does the process eventually reach an absorbing state? 2 Average number of times spent in a transient state, if starting in a transient state? 3 Average number of steps before entering an absorbing state? 4 Probability of being absorbed by a given absorbing state, when there are more than one, when starting in a given transient state?

Reaching an absorbing state Answer to question 1: Theorem 22 In an absorbing Markov chain, the probability of reaching an absorbing state is 1

Standard form of the transition matrix For an absorbing chain with k absorbing states and N transient states, the transition matrix can be written as Ik 0 P = R Q k with following meaning, Absorbing states Transient states Absorbing states I k 0 Transient states R Q with I k the k k identity matrix, 0 an k (N k) matrix of zeros, R an (N k) k matrix and Q an (N k) (N k) matrix.

The matrix I N k Q is invertible. Let F =(I N k Q) 1 be the fundamental matrix of the Markov chain T i be the sum of the entries on row i of F B = FR Answers to our remaining questions: 2 F ij is the average number of times the process is in the jth transient state if it starts in the ith transient state 3 T i is the average number of steps before the process enters an absorbing state if it starts in the ith transient state 4 B ij is the probability of eventually entering the jth absorbing state if the process starts in the ith transient state

Back to the SIS model ODE: I 0 = (N I )I ( + d)i This equation has 3 components: 1 (N I )I new infection 2 I recovery 3 di death In the DTMC, want to know what transitions mean and what their probabilities are Infection Infection Infection I=0 I=1 I=2 I=3 I=N-1 I=N Recovery or Death Recovery or Death Recovery or Death Recovery or Death

Consider small amount of time t, su ciently small that only one event occurs: new infection, loss of infectious individual, nothing.. Let B(i) := (N i)i D(i) :=( + d)i be rates of birth and death of infectious. Then p ji ( t) =P {I (t + )=j I(t) =i} 8 B(i) t j = i +1 >< D(i) t j = i 1 = 1 [B(i)+D(i)] t j = i >: 0 otherwise β( N 1)Δ t β( N 2)2 Δ t β( N 1)Δ t Infection Infection Infection I=0 I=1 I=2 I=3 I=N-1 I=N Recovery Recovery Recovery Recovery or Death or Death or Death or Death (γ+d )Δ t (γ+d )2 Δt (γ+d )3 Δ t (γ+d ) N Δ t

Transition matrix 0 1 1 D(1) t 0 1 (B(1) + D(1)) t 0 B(1) t B.... C @ A D(N) t 0 0 0 B(N 1) t 1 D(N) t Note that indices in the matrix range from 0 to N here

Properties p 0 is an absorbing state For any initial distribution p(0) = (p 0 (t), p 1 (0),...,p N (0)), lim p(t) =(1, t!1 0,...,0)T lim p 0 (t) =1 t!1 Exists quasi-stationary distribution conditioned on non-extinction q i (t) = p i(t) 1 p 0 (t), i =1,...,N

Consequence of absorption We have lim p(t) =(1, t!1 0,...,0)T lim p 0 (t) =1 t!1 but time to absorption can be exponential

1 Introduction 2 Stochastic processes 3 The SIS model used as an example 4 DTMC 5 CTMC

Several ways to formulate CTMC s A continuous time Markov chain can be formulated in terms of infinitesimal transition probabilities branching process time to next event Here, time is in R +

For small t, p ji ( t) =P {I (t + )=j I(t) =i} 8 B(i) t + o( t) j = i +1 >< D(i) t + o( t) j = i 1 = 1 [B(i)+D(i)] t + o( t) j = i >: o( t) otherwise with o( t)! 0as t! 0

Forward Kolmogorov equations Assume we know I (0) = k. Then p i (t + t) =p i 1 (t)b(i 1) t + p i+1 (t)d(i + 1) t + p i (t)[1 (B(i)+D(i)) t]+o( t) Compute (p i (t + t) p i (t))/ t and take lim t!0, giving d dt p 0 = p 1 D(1) d dt p i = p i 1 B(i 1) + p i+1 D(i + 1) p i [B(i)+D(i)] i =1,...,N Forward Kolmogorov equations associated to the CTMC

Write previous system as In vector form p 0 = Qp with 0 1 0 D(1) 0 0 0 (B(1) + D(1)) D(2) 0 Q = 0 B(1) (B(2) + D(2)) 0 B C @ D(N) A D(N) Q generator matrix. Of course, p(t) =e Qt p(0)

Linking DTMC and CTMC for small t DTMC: p(t + t) =P( t)p(t) for transition matrix P( t). Let t! 0, obtain Kolmogorov equations for CTMC d dt p = Qp where P( t) Q = lim t!0 t I = P 0 (0)

Going ODE to CTMC Easy to convert compartmental ODE model to CTMC!!

The general setting: flow diagram b S βsi γ I I ds di

ODE approach b S βsi γ I I ds di Focus on compartments b S βsi γ I βsi γ I I ds di

CTMC approach b S βsi γ I I ds di b Focus on arrows (transitions) S ds βsi γ I I di

Focus on transitions b S βsi γ I I ds di b: S! S +1 birth ds: S! S 1 death of susceptible SI : S! S 1, I! I + 1 new infection I : S! S + 1, I! I 1 recovery di : I! I 1 death of infectious Will use S = N I and omit S dynamics

Gillespie s algorithm (SIS model) 1: Set t t 0 and I (t) I (t 0 ) 2: while t apple t f do 3: t (N i)i + i + di 4: Draw t from T s E( t ) 5: v [ (N i)i/ t, (N i)i/ t + i/ t, 1] 6: Draw t from U([0, 1]) 7: Find pos such that t v(pos) 8: switch (pos) 9: case 1: New infection, I (t + t )=I(t)+1 10: case 2: End of infectious period, I (t + t )=I(t) 1 11: case 3: Death, I (t + t )=I(t) 1 12: end switch 13: t t + t 14: end while

IMPORTANT: in Gillespie s algorithm, we do not consider p ii,the event nothing happens

Drawing at random from an exponential distribution Want t from T s E( t ), i.e., T has probability density function f (x, t )= t e tx 1 x 0 Use cumulative distribution function F (x, t )= R x1 f (s, t) ds F (x, t )=(1 e tx )1 x 0 which has values in [0, 1]. So draw from U([0, 1]) and solve F (x, t )= for x: F (x, t )=, 1 e tx =, e tx =1, t x = ln(1 ), x = ln(1 ) t