tau {epimdr}R Documentation

Gillespie tau-leap algorithm

Description

Function simulating a dynamical system using the Gillespie tau-leap approximation

Usage

tau(rateqs, eventmatrix, parameters, initialvals, deltaT, endT)

Arguments

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

Value

A data frame with simulated time series

Examples

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)

[Package epimdr version 0.6-5 Index]