Description Usage Arguments Value See Also Examples

This function simulates a single realisation from a discrete stochastic kinetic model described by a stochastic Petri net (SPN).

1 |

`N` |
An R list with named components representing a stochastic
Petri net (SPN). Should contain |

`n` |
An integer representing the number of events to simulate, excluding the initial state, |

`...` |
Additional arguments (such as reactions rates) will be passed into the function |

A list with first component `t`

, a vector of length `n`

containing event times and second component `x`

, a matrix with `n+1`

rows containing the state of the system. The `i`

th row of `x`

contains the state of the system prior to the `i`

th event.

`simpleEuler`

, `rdiff`

,
`discretise`

, `gillespied`

, `StepGillespie`

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# load the LV model
data(spnModels)
# simulate a realisation of the process and plot it
out = gillespie(LV,10000)
op = par(mfrow=c(2,2))
plot(stepfun(out$t,out$x[,1]),pch="")
plot(stepfun(out$t,out$x[,2]),pch="")
plot(out$x,type="l")
# use the "discretise" function to map it to an R "ts" object
plot(discretise(out,dt=0.01),plot.type="single",lty=c(1,2))
par(op)
``` |

```
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.