Simulate a sample path from a stochastic kinetic model described by a stochastic Petri net
This function simulates a single realisation from a discrete stochastic kinetic model described by a stochastic Petri net (SPN).
An R list with named components representing a stochastic
Petri net (SPN). Should contain
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
ith row of
x contains the state of the system prior to the
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)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.