individualHomogeneousSIR_Gillespie: Incorporate the ideas of the event matrix and a matrix of...

Description Usage Details

View source: R/simplified_gillespies.R

Description

e.g for SIR

Usage

1

Details

3 states, N individuals

Nx3 matrix

ith row pertains to the ith individual One element of the ith row will be TRUE which will indicate which infectious state the ith individual is in. The other enteries will have value FALSE.

Due to TRUE/FALSE behaving in the exact same way as 1/0 repsectively in R, if needed the summary of number of individuals in each state can be obtained by summing over the respective columns.

Hence, this matrix tells us everything about the current state of the epidemic. Need to know the set of individuals how are in each state Also need summary of how many people (this will save operations)

Not knowing how many people are in a state will mean everytime we want to calculate the total rate we have to sum over the columns of the first two columns of the stateMatrix

This will mean there are 2N more operations per event.

So it is more efficient to keep a similar state vector to the homogeneous population level Gillespie. This takes only one extra operation per event (updating the state vector) Possible states and their respective logical representations. Summarise in matrix Initial state of each individual Initial state of epidemic at population level Possible Events Summarise in a matrix event table Waiting Time #' Which event happens? Update Population State Update Individual State Record event


JMacDonaldPhD/Epidemics documentation built on Jan. 10, 2020, 2:48 a.m.