hitch {pomp} | R Documentation |
Hitching C snippets and R functions to pomp_fun objects
Description
The algorithms in pomp are formulated using R functions that access the basic model components
(rprocess
, dprocess
, rmeasure
, dmeasure
, etc.).
For short, we refer to these elementary functions as “workhorses”.
In implementing a model, the user specifies basic model components
using functions, procedures in dynamically-linked libraries, or C snippets.
Each component is then packaged into a ‘pomp_fun’ objects, which gives a uniform interface.
The construction of ‘pomp_fun’ objects is handled by the hitch
function,
which conceptually “hitches” the workhorses to the user-defined procedures.
Usage
hitch(
...,
templates,
obsnames,
statenames,
paramnames,
covarnames,
PACKAGE,
globals,
cfile,
cdir = getOption("pomp_cdir", NULL),
on_load,
shlib.args,
compile = TRUE,
verbose = getOption("verbose", FALSE)
)
Arguments
... |
named arguments representing the user procedures to be hitched.
These can be functions, character strings naming routines in external, dynamically-linked libraries, C snippets, or |
templates |
named list of templates.
Each workhorse must have a corresponding template.
See |
obsnames , statenames , paramnames , covarnames |
character vectors specifying the names of observable variables, latent state variables, parameters, and covariates, respectively. These are only needed if one or more of the horses are furnished as C snippets. |
PACKAGE |
optional character;
the name (without extension) of the external, dynamically loaded library in which any native routines are to be found.
This is only useful if one or more of the model components has been specified using a precompiled dynamically loaded library;
it is not used for any component specified using C snippets.
|
globals |
optional character or C snippet;
arbitrary C code that will be hard-coded into the shared-object library created when C snippets are provided.
If no C snippets are used, |
cfile |
optional character variable.
|
cdir |
optional character variable.
|
on_load |
optional character or C snippet:
arbitrary C code that will be executed when the C snippet file is loaded.
If no C snippets are used, |
shlib.args |
optional character variables.
Command-line arguments to the |
compile |
logical;
if |
verbose |
logical.
Setting |
Value
hitch
returns a named list of length two. The element named
“funs” is itself a named list of ‘pomp_fun’ objects, each of
which corresponds to one of the horses passed in. The element named
“lib” contains information on the shared-object library created
using the C snippets (if any were passed to hitch
). If no C
snippets were passed to hitch
, lib
is NULL
.
Otherwise, it is a length-3 named list with the following elements:
- name
The name of the library created.
- dir
The directory in which the library was created. If this is
NULL
, the library was created in the session's temporary directory.- src
A character string with the full contents of the C snippet file.
Author(s)
Aaron A. King