Specification of dmeasure.
The measurement model is the link between the data and the unobserved state process.
It can be specified either by using one or both of the
Suppose you have a procedure to compute the probability density of an observation given the value of the latent state variables. Then you can furnish
dmeasure = f
to pomp algorithms,
f is a C snippet or R function that implements your procedure.
Using a C snippet is much preferred, due to its much greater computational efficiency.
Csnippet for general rules on writing C snippets.
The goal of a dmeasure C snippet is to fill the variable
lik with the either the probability density or the log probability density, depending on the value of the variable
In writing a
dmeasure C snippet, observe that:
In addition to the states, parameters, covariates (if any), and observables, the variable
t, containing the time of the observation will be defined in the context in which the snippet is executed.
Moreover, the Boolean variable
give_log will be defined.
The goal of a dmeasure C snippet is to set the value of the
lik variable to the likelihood of the data given the state, if
give_log == 0.
give_log == 1,
lik should be set to the log likelihood.
dmeasure is to be provided instead as an R function, this is accomplished by supplying
dmeasure = f
f is a function.
The arguments of
f should be chosen from among the observables, state variables, parameters, covariates, and time.
It must also have the arguments
It can take additional arguments via the userdata facility.
f must return a single numeric value, the probability density (or log probability density if
log = TRUE) of
x at time
It is a common error to fail to account for both
log = TRUE and
log = FALSE when writing the
dmeasure C snippet or function.
dmeasure is left unspecified, calls to
dmeasure will return missing values (
Some Windows users report problems when using C snippets in parallel computations.
These appear to arise when the temporary files created during the C snippet compilation process are not handled properly by the operating system.
To circumvent this problem, use the
cfile options (described here) to cause the C snippets to be written to a file of your choice, thus avoiding the use of temporary files altogether.
More on implementing POMP models:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.