Description Usage Arguments Value See Also Examples
This function discretise output from a discrete event simulation algorithm such as gillespie
onto a regular time grid, and returns the results as an R ts
object.
1 | discretise(out, dt=1, start=0)
|
out |
A list containing discrete event simulation output in the form of that produced by |
dt |
The time step required for the output of the discretisation process. Defaults to one time unit. |
start |
The start time for the output. Defaults to zero. |
An R ts
object containing the discretised output.
simpleEuler
, rdiff
, gillespie
, gillespied
, ts
1 2 3 4 5 6 7 8 9 10 11 12 | # load 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.