# tau: Gillespie tau-leap algorithm In epimdr: Functions and Data for "Epidemics: Models and Data in R"

## Description

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

## Usage

 `1` ```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

 ```1 2 3 4 5 6 7``` ```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) ```

### Example output

```Loading required package: shiny