# Simulate a sample path from a stochastic kinetic model described by a stochastic Petri net

### Description

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

### Usage

1 |

### Arguments

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

### Value

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.

### See Also

`simpleEuler`

, `rdiff`

,
`discretise`

, `gillespied`

, `StepGillespie`

### Examples

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