Learn R Programming

pomp (version 0.53-5)

pompBuilder: Write, compile, link, and build a pomp object using native codes

Description

pompBuilder is a facility for producing compiled pomp objects.

Usage

pompBuilder(data, times, t0, name, statenames, paramnames, 
            tcovar, covar,
            rmeasure, dmeasure, step.fn, step.fn.delta.t,
            skeleton, skeleton.type = c("map","vectorfield"),
            skelmap.delta.t = 1,
            parameter.transform, parameter.inv.transform,
            rprior, dprior,
            globals, ..., link = TRUE, save = FALSE)

Arguments

data, times, t0
The data, times, and zero-time. See pomp for more information. data must be a data-frame.
name
character; the stem of the name for the files that will be produced.
statenames, paramnames
names of state-variables and parameters, respectively
tcovar, covar
optional. covar is a data-frame containing covariates (variables in columns, timepoints in rows); tcovar is the name of the column containing time.
rmeasure, dmeasure
C codes implementing the measurement model
step.fn, step.fn.delta.t
step.fn is a C code that implements an Euler step function. The Euler time-step is step.fn.delta.t, which should be a positive number.
skeleton, skeleton.type, skelmap.delta.t
skeleton is a C code that implements the deterministic skeleton. As in pomp, skeleton.type indicates whether the skeleton is a map (discrete-time) or vectorfield (continuous-time)
parameter.transform, parameter.inv.transform
optional C codes that implement parameter transformations. parameter.transform maps parameters from the estimation scale to the natural scale; parameter.inv.transformation maps them from the natural scale to the estimatio
rprior, dprior
C codes implementing the prior distribution
globals
optional. C codes here will be included verbatim in the generated code and compiled into the shared-object library.
...
additional arguments are passed to pomp
link
logical; if TRUE, the resulting code will be linked after compilation.
save
logical; if TRUE, the resulting C code will be saved in the current working directory. The shared-object library will also be created in this directory. If FALSE, the C code and shared-object library will be created in the temporary directory.

Value

  • The constructed pomp object. A side-effect is the writing and compilation of a C code into a dynamics shared object. These files will reside in the current working directory (see getwd). If pompBuilder has been called with link=FALSE, this dynamic shared object must be linked (see dyn.load) before the pomp object can be used.

    Parallel computing caution: note that, since a side-effect of running pompBuilder is the writing and compilation of a file, caution must be used when running parallel computations. Simultaneous execution of pompBuilder on nodes sharing a common disk will cause all nodes to attempt to write the same file at the same time; the results will be undefined. If multiple nodes are to work on the same pomp object built by pompBuilder, first run pompBuilder once (perhaps with link=FALSE) to write the C file and compile it into a dynamic shared object file. The pomp object returned by pompBuilder can then be shared with all worker nodes. Note, however, that all worker nodes must dynamically load (using dyn.load) the dynamic shared object file before anything can be done with the pomp object.

Details

pompBuilder with save=TRUE assumes that files can be written to the current working directory and that dynamic shared objects can be compiled and linked, i.e., that R CMD SHLIB will work. This will not typically be the case in out-of-the-box Windows installations.

See Also

pomp and the demos.

Examples

Run this code
## see the demos

Run the code above in your browser using DataLab