pomp {pomp} | R Documentation |
Create a new pomp
object.
pomp(data, times, t0, rprocess, dprocess, rmeasure, dmeasure, ...)
data |
An array holding the data. This array is of dimensions
nobs x ntimes , where nobs is the number of
observed variables and ntimes is the number of times at which
observations were made. |
times |
The times corresponding to the observations.
times must be a strictly increasing numeric vector. |
t0 |
The zero-time. This must be prior to the first observation. |
rprocess |
Function of prototype
rprocess(xstart,times,params,...) which simulates from the
unobserved process. |
dprocess |
Function of prototype
dprocess(x,times,params,log=FALSE,...) which evaluates
the likelihood of a sequence of consecutive state transitions. |
rmeasure |
Function of prototype
rmeasure(x,times,params,...)
which simulates from the observation process. |
dmeasure |
Function of prototype
dmeasure(y,x,times,params,log=FALSE,...) which gives the
likelihood of y given x . |
... |
Any additional arguments are stored in a slot `userdata'
and are passed as arguments to each of the functions
rprocess , dprocess , rmeasure , and
dmeasure whenever they are evaluated. Using this mechanism,
the user can store additional information necessary for the
definition of the model. |
It is the user's responsibility to ensure that the
rprocess
, dprocess
, rmeasure
, and
dmeasure
elements satisfy the following conditions:
rprocess
must have at least the following arguments: xstart
,
times
, params
, and ...
. Additional arguments
may be specified. It is guaranteed that these will be filled with the
corresponding elements the user has included as additional arguments
in the construction of the pomp
object.
In calls to rprocess
, xstart
will be a rank-2 array
(matrix) with rows corresponding to state variables and columns
corresponding to independent realizations of the process.
params
will similarly be a rank-2 array with rows corresponding
to parameters and columns corresponding to independent realizations.
The columns of params
are to be matched up with those of
xstart
; in particular, they will agree in number. Both
xstart
and params
must have rownames, which are
available for use by the user.
rprocess
must return a rank-3 array with rownames. Suppose
x
is the array returned. Then
dim(x)=c(nvars,nreps,ntimes)
, where nvars
is the number
of state variables (=nrow(xstart)
), nreps
is the number
of independent realizations simulated (=ncol(xstart)
), and
ntimes
is the length of the vector times
.
x[,j,k]
is the value of the state process in the j
-th
realization at time times[k]
. In particular, x[,,1]
must be identical to xstart
. The rownames of x
must
correspond to those of xstart
.
dprocess
must have at least the following arguments: x
,
times
, params
, log
, and ...
. Additional
arguments may be passed. It is guaranteed that these will be filled
with the corresponding elements the user has included as additional
arguments in the construction of the pomp
object.
In calls to dprocess
, x
will be an nvars
x
nreps
x ntimes
array, where these terms have the same
meanings as above. params
will be a rank-2 array with rows
corresponding to individual parameters and columns corresponding to
independent realizations. The columns of params
are to be
matched up with those of x
; in particular, they will agree in
number. Both x
and params
must have rownames, available
for use by the user.
dprocess
must return a rank-2 array (matrix). Suppose d
is the array returned. Then dim(d)=c(nreps,ntimes-1)
.
d[j,k]
is the probability density of the transition from state
x[,j,k-1]
at time times[k-1]
to state x[,j,k]
at
time times[k]
. If log=TRUE
, then the log of the
p.d.f. is returned. It can be assumed that the transitions
are consecutive.
rmeasure
must have at least the arguments x
,
times
, params
, and ...
. Additional arguments
may be passed and will be filled with user-specified data as above.
x
must be a rank-3 array dimension
c(nvars,nreps,ntimes)
, where these variables have the same
meanings as above. times
is the corresponding set of times.
rmeasure
must return a rank-3 array. If y
is the
returned array, then dim(y)=c(nobs,nreps,ntimes)
, where
nobs
is the number of observable variables and nreps
,
ntimes
agree with the corresponding dimensions of x
.
y[,j,k]
must be the vector of observables in the j
-th
realization at time times[k]
.
dmeasure
must have at least the arguments y
, x
,
times
, params
, log
, and ...
. y
is
a rank-2 array of observations (nobs
x ntimes
);
x
, a rank-3 array of states; params
a rank-2 array
containing parameters, and times
the corresponding observation
times. Additional arguments may be passed and will be filled with
user-specified data as above. dmeasure
must return a rank-2
array of dimension nreps
x ntimes
. If d
is the
returned array, then d[j,k]
is the p.d.f. of y[,k]
given
x[,j,k]
at time times[k]
. If log=TRUE
, then the
log of the p.d.f. is returned.
An object of class pomp
.
Some error checking is done, but complete error checking is impossible. If the user-specified functions do not conform to the above specifications (see Details), then the results may be invalid.
Aaron A. King (kingaa at umich dot edu)
x <- pomp(data=rbind(y=rnorm(100)),times=1:100,t0=0) print(x) plot(x) time(x) ## See the vignettes for more instructive examples.