rprocess
and dprocess
slots of pomp
.onestep.sim(step.fun, PACKAGE)
euler.sim(step.fun, delta.t, PACKAGE)
discrete.time.sim(step.fun, delta.t = 1, PACKAGE)
gillespie.sim(rate.fun, v, d, PACKAGE)
onestep.dens(dens.fun, PACKAGE)
rate.fun(j,x,t,params,...)
.
Here, j
is the nvar
x nevent
, where nvar
is the number of state variables and nevent
is the nudens.fun(x1,x2,t1,t2,params,...)
.
Heonestep.sim
is the appropriate choice when it is possible to simulate the change in state from one time to another, regardless of how large the interval between them is.
To use onestep.sim
, you must write a function step.fun
that will advance the state process from one arbitrary time to another.
euler.sim
is appropriate when one cannot do this but can compute the change in state via a sequence of smaller steps.
This is desirable, for example, if one is simulating a continuous time process but is willing to approximate it using an Euler approach.
discrete.time.sim
is appropriate when the process evolves in discrete time.
In this case, by default, the intervals between observations are integers. To use euler.sim
or discrete.time.sim
, you must write a function step.fun
that will take a single Euler step, of size at most delta.t
.
euler.sim
and discrete.time.sim
will create simulators that take as many steps as needed to get from one time to another.
See below for information on how euler.sim
chooses the actual step size it uses.
gillespie.sim
allows exact simulation of a continuous-time, discrete-state Markov process using Gillespie's algorithm.
This is an gillespie.sim
, you must write a function rate.fun
that computes the rates of each elementary event and specify two matrices (d,v
) that describe, respectively, the dependencies of each rate and the consequences of each event.
onestep.dens
will generate a suitable dprocess
function when one can compute the likelihood of a given state transition simply by knowing the states at two times under the assumption that the state has not changed between the times.
This is typically possible, for instance, when the rprocess
function is implemented using onestep.sim
, euler.sim
, or discrete.time.sim
.
[NB: currently, there are no high-level algorithms in dprocess
.
This function is provided for completeness only, and with an eye toward future development.]
If step.fun
is written as an Rfunction, it must have at least the arguments x
, t
, params
, delta.t
, and ...
.
On a call to this function, x
will be a named vector of state variables, t
a scalar time, and params
a named vector of parameters.
The length of the Euler step will be delta.t
.
If the argument covars
is included and a covariate table has been included in the pomp
object, then on a call to this function, covars
will be filled with the values, at time t
, of the covariates.
This is accomplished via interpolation of the covariate table.
Additional arguments may be given: these will be filled by the correspondingly-named elements in the userdata
slot of the pomp
object (see pomp
).
If step.fun
is written in a native language, it must be a function of type
If rate.fun
is written as an Rfunction, it must have at least the arguments j
, x
, t
, params
, and ...
.
Here, j
is the an integer that indicates which specific elementary event we desire the rate of.
x
is a named vector containing the value of the state process at time t
, and
params
is a named vector containing parameters.
If the argument covars
is included and a covariate table has been included in the pomp
object, then on a call to this function, covars
will be filled with the values, at time t
, of the covariates.
This is accomplished via interpolation of the covariate table.
If rate.fun
is a native function, it must be of type dens.fun
, you must assume that no state transitions have occurred between t1
and t2
.
If dens.fun
is written as an Rfunction, it must have at least the arguments x1
, x2
, t1
, t2
, params
, and ...
.
On a call to this function, x1
and x2
will be named vectors of state variables at times t1
and t2
, respectively.
The named vector params
contains the parameters.
If the argument covars
is included and a covariate table has been included in the pomp
object, then on a call to this function, covars
will be filled with the values, at time t1
, of the covariates.
If the argument covars
is included and a covariate table has been included in the pomp
object, then on a call to this function, covars
will be filled with the values, at time t1
, of the covariates.
This is accomplished via interpolation of the covariate table.
As above, any additional arguments will be filled by the correspondingly-named elements in the userdata
slot of the pomp
object (see pomp
).
If dens.fun
is written in a native language, it must be a function of type
eulermultinom
, pomp
## examples showing how to use these functions
## are provided in the vignette "intro_to_pomp"
vignette("intro_to_pomp")
Run the code above in your browser using DataLab