StepPTS {smfsb} | R Documentation |
Create a function for advancing the state of an SPN by using a simple approximate Poisson time stepping method
Description
This function creates a function for advancing the state of an SPN model using a simple approximate Poisson time stepping method. The resulting function (closure) can be used in conjunction with other functions (such as simTs
) for simulating realisations of SPN models.
Usage
StepPTS(N,dt=0.01)
Arguments
N |
An R list with named components representing a stochastic
Petri net. Should contain |
dt |
Time step to be used by the Poisson time stepping integration method. Defaults to 0.01. |
Value
An R function which can be used to advance the state of the SPN model N
by using a Poisson time stepping method with step size dt
. The function closure has interface function(x0,t0,deltat,...)
, where x0
and t0
represent the initial state and time, and deltat
represents the amount of time by which the process should be advanced. The function closure returns a vector representing the simulated state of the system at the new time.
See Also
StepGillespie
, StepCLE
, simTs
, simSample
Examples
# load up the LV model
data(spnModels)
# create a stepping function
stepLV=StepPTS(LV)
# step the function
print(stepLV(c(x1=50,x2=100),0,1))
# integrate the process and plot it
out = simTs(c(x1=50,x2=100),0,20,0.1,stepLV)
plot(out)
plot(out,plot.type="single",lty=1:2)