rprocess
and dprocess
slots of pomp
.euler.simulate(xstart, times, params, step.fun, delta.t, ...,
statenames = character(0), paramnames = character(0),
covarnames = character(0), zeronames = character(0),
tcovar, covar, PACKAGE)
onestep.simulate(xstart, times, params, step.fun, ...,
statenames = character(0), paramnames = character(0),
covarnames = character(0), zeronames = character(0),
tcovar, covar, PACKAGE)
onestep.density(x, times, params, dens.fun, ...,
statenames = character(0), paramnames = character(0),
covarnames = character(0), tcovar, covar, log = FALSE,
PACKAGE)
nvar
x nrep
) of states at initial time times[1]
.nvar
x nrep
x ntimes
) of states at times times
.ntimes
) at which states are required or given.nrep
columns of params
correspond to those of xstart
.step.fun
and dens.fun
.
This information is only used when the latter are implemented as compiled native functions.times
.
These are useful, e.g., for storing accumulations of state variables.step.fun
(or dens.fun
) is an R function, then additional arguments will be passed to it.
If step.fun
(or dens.fun
) is a native routine, then additional arguments are ignored.euler.simulate
and onestep.simulate
each return a nvar
x nrep
x ntimes
array, where nvar
is the number of state variables, nrep
is the number of replicate simulations (= number of columns of xstart
and params
), and ntimes
is the length of times
.
If x
is this array, x[,,1]
will be identical to xstart
; the rownames of x
and xstart
will also coincide. onestep.density
returns a nrep
x ntimes-1
array.
If f
is this array, f[i,j]
is the likelihood of a transition from x[,i,j]
to x[,i,j+1]
in exactly one Euler step of duration times[j+1]-times[j]
.
onestep.simulate
assumes that a single call to step.fun
will advance the state process from one time to the next.
euler.simulate
will take multiple Euler steps, each of size at most delta.t
(see below for information on how the actual Euler step size is chosen) to get from one time to the next. onestep.density
assumes that no state transitions occure between consecutive times.
If step.fun
is written as an R function, 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 "pomp_onestep_sim" as specified in the header "pomp.h" included with the package (see the directory "include" in the installed package directory).
If dens.fun
is written as an R function, 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.
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 "pomp_onestep_pdf" as defined in the header "pomp.h" included with the package (see the directory "include" in the installed package directory).
eulermultinom
, pomp
## an example showing how to use these functions to implement a seasonal SIR model is contained
## in the 'examples' directory
edit(file=system.file("examples/euler_sir.R",package="pomp"))
Run the code above in your browser using DataLab