dmeasure_spec {pomp} | R Documentation

## The measurement model density

### Description

Specification of dmeasure.

### Details

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 `rmeasure` and `dmeasure` arguments.

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, where `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. See `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 `give_log`.

In writing a `dmeasure` C snippet, observe that:

1. 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.

2. Moreover, the Boolean variable `give_log` will be defined.

3. 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`. If `give_log == 1`, `lik` should be set to the log likelihood.

If `dmeasure` is to be provided instead as an R function, this is accomplished by supplying

      dmeasure = f

to `pomp`, where `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 `...`, and `log`. It can take additional arguments via the facility. `f` must return a single numeric value, the probability density (or log probability density if `log = TRUE`) of `y` given `x` at time `t`.

### Important note

It is a common error to fail to account for both `log = TRUE` and `log = FALSE` when writing the `dmeasure` C snippet or function.

### Default behavior

If `dmeasure` is left unspecified, calls to `dmeasure` will return missing values (`NA`).

### See Also

Other information on model implementation: `Csnippet`, `accumulators`, `covariate_table`, `distributions`, `dprocess_spec`, `parameter_trans`, `pomp-package`, `prior_spec`, `rinit_spec`, `rmeasure_spec`, `rprocess_spec`, `skeleton_spec`, `transformations`, `userdata`

[Package pomp version 2.3 Index]