Gillespie Stochastic Simulation in Discrete Time using R -


i'm simulating stochastic simulation epidemiology. how simulate in discrete time? managed obtain continuous time using coding below.

library(gillespiessa)     parms <- c(beta=0.591,sigma=1/8,gamma=1/7)     x0 <- c(s=50,e=0,i=1,r=0)     <- c("beta*s*i","sigma*e","gamma*i")     nu <- matrix(c(-1,0,0, 1,-1,0, 0,1,-1, 0,0,1),nrow=4,byrow=true)    set.seed(12345)     out <- lapply(x=1:10,fun=function(x) ssa(x0,a,nu,parms,tf=50)$data) out 

how should alter coding discrete time? thanking in advance.

the gillespie algorithm (see this paper) simulates trajectory of continuous-time markov chain (it discrete-event simulation approach).

broadly speakig, means each event in out associated continuous time, , this inherent simulation approach used (i.e., not easy change).

however, you can find out state of model @ discrete points in time: state of model before first event higher time stamp.

example: observe reaction event e_1 @ time 1.932.., e_2 @ time 1.999892.., , e_3 @ time 2.00892... state of model @ time t=2.0 state after event e_2 occurred , before event e_3 occurred.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -