tau | R Documentation |
Function simulating a dynamical system using the Gillespie tau-leap approximation
tau(rateqs, eventmatrix, parameters, initialvals, deltaT, endT)
rateqs |
a list with rate equations |
eventmatrix |
a matrix of changes in state variables associated with each event |
parameters |
a vector of parameter values |
initialvals |
a vector of initial values for the states |
deltaT |
the tau-leap time interval |
endT |
the time length of simulation |
A data frame with simulated time series
rlist2=c(quote(mu * (S+E+I+R)), quote(mu * S), quote(beta * S * I/(S+E+I+R)), quote(mu*E), quote(sigma * E), quote(mu * I), quote(gamma * I), quote(mu*R)) emat2=matrix(c(1,0,0,0,-1,0,0,0,-1,1,0,0,0,-1,0,0,0,-1,1,0,0,0,-1,0,0,0,-1,1,0,0,0,-1), ncol=4, byrow=TRUE) paras = c(mu = 1, beta = 1000, sigma = 365/8, gamma = 365/5) inits = c(S=999, E=0, I=1, R = 0) sim2=tau(rlist2, emat2, paras, inits, 1/365, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.