Learn R Programming

pomp (version 1.4.1.1)

pomp constructor: Constructor of the basic POMP object

Description

This function constructs a pomp object, encoding a partially-observed Markov process model together with a uni- or multivariate time series. One implements the model by specifying its components, each of which can be written as Rfunctions or, for much greater computational efficiency, using C code. The preferred way to specify most components (as detailed below) is through the use of Csnippets, snippets of C that are compiled and linked into a running Rsession.

Usage

## S3 method for class 'data.frame':
pomp(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
       measurement.model,
       skeleton, skeleton.type = c("map","vectorfield"), skelmap.delta.t = 1,
       initializer, rprior, dprior, params, covar, tcovar,
       obsnames, statenames, paramnames, covarnames, zeronames,
       PACKAGE, fromEstimationScale, toEstimationScale, globals, cdir, cfile)
## S3 method for class 'numeric':
pomp(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
       measurement.model,
       skeleton, skeleton.type = c("map","vectorfield"), skelmap.delta.t = 1,
       initializer, rprior, dprior, params, covar, tcovar,
       obsnames, statenames, paramnames, covarnames, zeronames,
       PACKAGE, fromEstimationScale, toEstimationScale, globals, cdir, cfile)
## S3 method for class 'matrix':
pomp(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
       measurement.model,
       skeleton, skeleton.type = c("map","vectorfield"), skelmap.delta.t = 1,
       initializer, rprior, dprior, params, covar, tcovar,
       obsnames, statenames, paramnames, covarnames, zeronames,
       PACKAGE, fromEstimationScale, toEstimationScale, globals, cdir, cfile)
## S3 method for class 'pomp':
pomp(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
       measurement.model, skeleton, skeleton.type, skelmap.delta.t,
       initializer, rprior, dprior, params, covar, tcovar,
       obsnames, statenames, paramnames, covarnames, zeronames,
       PACKAGE, fromEstimationScale, toEstimationScale, globals, cdir, cfile)

Arguments

data, times
The time series data and times at which observations are made. data can be specified as a vector, a matrix, a data-frame. Alternatively, a pomp object can be supplied in the data argument.

If data<

t0
The zero-time, at which the stochastic dynamical system is to be initialized. This must be no later than the time of the first observation, i.e., t0 <= times[1]<="" code="">.
rprocess
optional function; a function of prototype rprocess(xstart,times,params,...) that simulates from the unobserved process. The form of this function is given below. pomp provides a number of plugins
cdir, cfile
optional character. cdir specifies the name of the directory within which Csnippet code will be compiled. By default, this is in a temporary directory specific to the running instance of R. cfile gives th
...
Any additional arguments given to pomp will be stored in the pomp object and passed as arguments to each of the basic functions whenever they are evaluated.

Value

  • pomp returns an object of class pomp. If data is an object of class pomp, then by default the returned pomp object is identical to data. If additional arguments are given, these override the defaults.

Important note

It is not typically necessary (or even feasible) to define all of the components rprocess, dprocess, rmeasure, dmeasure, and skeleton in any given problem. Each algorithm makes use of only a subset of these components. Any algorithm requiring a component that has not been defined will return an informative error.

The deterministic skeleton

The following describes how to specify the deterministic skeleton as an Rfunction. For a description on how to write this component using Csnippets, see the tutorials on the http://kingaa.github.io/pomp{package website} and the Csnippet help.

If skeleton if provided, must have at least the arguments x, t, params, and .... x is a numeric vector containing the coordinates of a point in state space at which evaluation of the skeleton is desired. t is a numeric value giving the time at which evaluation of the skeleton is desired. Of course, these will be irrelevant in the case of an autonomous skeleton. params is a numeric vector holding the parameters. skeleton may take additional arguments, which will be filled, as above, with user-specified data.

skeleton must return a numeric vector of the same length as x, which contains the value vectorfield (if the dynamical system is continuous) or the value of the map (if the dynamical system is discrete), at the point x at time t.

The state-process initializer

if provided, must have at least the arguments params, t0, and .... params will be a named numeric vector of parameters. t0 will be the time at which initial conditions are desired. initializer must return a named numeric vector of initial states.

Covariates

If the pomp object contains covariates (via the covar argument; see above), then whenever any of the Rfunctions described above are called, they will each be supplied with an additional argument covars. This will be a named numeric vector containing the (interpolated) values of the covariates at the time t. In particular, covars will have one value for each column of the covariate table.

Accumulator variables

In formulating models, one often wishes to define a state variable that will accumulate some quantity over the interval between successive observations. pomp provides a facility to make such features more convenient. Specifically, variables named in the pomp's zeronames argument will be set to zero immediately following each observation. See euler.sir and the tutorials on the http://kingaa.github.io/pomp{package website} for examples.

Warning

Some error checking is done by pomp, but complete error checking is impossible. If the user-specified functions do not conform to the above specifications, then the results may be invalid. In particular, if both rmeasure and dmeasure are specified, the user should verify that these two functions correspond to the same probability distribution. If skeleton is specified, the user is responsible for verifying that it corresponds to a deterministic skeleton of the model. Each pomp-package algorithm uses some subset of the five basic functions (rprocess, dprocess, rmeasure, dmeasure, skeleton). If an algorithm requires a component that has not been specified, an informative error will be generated.

See Also

pomp methods, pomp low-level interface, process model plugins

Examples

Run this code
pompExample()
pomp.home <- system.file("examples",package="pomp")
pomp.examples <- list.files(pomp.home)
file.show(
          file.path(pomp.home,pomp.examples),
          header=paste("======",pomp.examples,"=======")
         )

Run the code above in your browser using DataLab