prior_spec {pomp} | R Documentation

## prior specification

### Description

Specify the prior distribution

### Details

A prior distribution on parameters is specified by means of the `rprior` and/or `dprior` arguments to `pomp`. As with the other basic model components, it is preferable to specify these using C snippets. In writing a C snippet for the prior sampler (`rprior`), keep in mind that:

1. Within the context in which the snippet will be evaluated, only the parameters will be defined.

2. The goal of such a snippet is the replacement of parameters with values drawn from the prior distribution.

3. Hyperparameters can be included in the ordinary parameter list. Obviously, hyperparameters should not be replaced with random draws.

In writing a C snippet for the prior density function (`dprior`), observe that:

1. Within the context in which the snippet will be evaluated, only the parameters and `give_log` will be defined.

2. The goal of such a snippet is computation of the prior probability density, or the log of same, at a given point in parameter space. This scalar value should be returned in the variable `lik`. When `give_log == 1`, `lik` should contain the log of the prior probability density.

3. Hyperparameters can be included in the ordinary parameter list.

Alternatively, one can furnish R functions for one or both of these arguments. In this case, `rprior` must be a function of prototype

      f(params, \dots)

that makes a draw from the prior distribution given `params` and returns a named vector of the same length and with the same set of names, as `params`. The `dprior` function must be of prototype

      f(params, log = FALSE, \dots).

Its role is to evaluate the prior probability density (or log density if `log == TRUE`) and return that single scalar value.

### Default behavior

By default, the prior is assumed flat and improper. In particular, `dprior` returns `1` (`0` if `log = TRUE`) for every parameter set. Since it is impossible to simulate from a flat improper prior, `rprocess` returns missing values (`NA`s).

### See Also

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

[Package pomp version 2.3 Index]