Description Usage Arguments Value Examples
Function simulating a dynamical system using the Gillespie exact algorithm
1 | gillespie(rateqs, eventmatrix, parameters, initialvals, numevents)
|
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 |
numevents |
number of events to be simulated |
A data frame with simulated time series
1 2 3 4 5 6 | rlist=c(quote(mu * (S+I+R)), quote(mu * S), quote(beta * S * I /(S+I+R)),
quote(mu * I), quote(gamma * I), quote(mu*R))
emat=matrix(c(1,0,0,-1,0,0,-1,1,0,0,-1,0,0,-1,1,0,0,-1),ncol=3, byrow=TRUE)
paras = c(mu = 1, beta = 1000, gamma = 365/20)
inits = c(S=100, I=2, R=0)
sim=gillespie(rlist, emat, paras, inits, 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.