Learn R Programming

pomp (version 3.3)

bsmc2: The Liu and West Bayesian particle filter

Description

Modified version of the Liu and West (2001) algorithm.

Usage

# S4 method for data.frame
bsmc2(
  data,
  Np,
  smooth = 0.1,
  params,
  rprior,
  rinit,
  rprocess,
  dmeasure,
  partrans,
  ...,
  verbose = getOption("verbose", FALSE)
)

# S4 method for pomp bsmc2(data, Np, smooth = 0.1, ..., verbose = getOption("verbose", FALSE))

Arguments

data

either a data frame holding the time series data, or an object of class ‘pomp’, i.e., the output of another pomp calculation.

Np

the number of particles to use. This may be specified as a single positive integer, in which case the same number of particles will be used at each timestep. Alternatively, if one wishes the number of particles to vary across timesteps, one may specify Np either as a vector of positive integers of length

length(time(object,t0=TRUE))

or as a function taking a positive integer argument. In the latter case, Np(k) must be a single positive integer, representing the number of particles to be used at the k-th timestep: Np(0) is the number of particles to use going from timezero(object) to time(object)[1], Np(1), from timezero(object) to time(object)[1], and so on, while when T=length(time(object)), Np(T) is the number of particles to sample at the end of the time-series.

smooth

Kernel density smoothing parameter. The compensating shrinkage factor will be sqrt(1-smooth^2). Thus, smooth=0 means that no noise will be added to parameters. The general recommendation is that the value of smooth should be chosen close to 0 (e.g., shrink ~ 0.1).

params

optional; named numeric vector of parameters. This will be coerced internally to storage mode double.

rprior

optional; prior distribution sampler, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. For more information, see ?prior_spec. Setting rprior=NULL removes the prior distribution sampler.

rinit

simulator of the initial-state distribution. This can be furnished either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting rinit=NULL sets the initial-state simulator to its default. For more information, see ?rinit_spec.

rprocess

simulator of the latent state process, specified using one of the rprocess plugins. Setting rprocess=NULL removes the latent-state simulator. For more information, see ?rprocess_spec for the documentation on these plugins.

dmeasure

evaluator of the measurement model density, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting dmeasure=NULL removes the measurement density evaluator. For more information, see ?dmeasure_spec.

partrans

optional parameter transformations, constructed using parameter_trans.

Many algorithms for parameter estimation search an unconstrained space of parameters. When working with such an algorithm and a model for which the parameters are constrained, it can be useful to transform parameters. One should supply the partrans argument via a call to parameter_trans. For more information, see ?parameter_trans. Setting partrans=NULL removes the parameter transformations, i.e., sets them to the identity transformation.

...

additional arguments supply new or modify existing model characteristics or components. See pomp for a full list of recognized arguments.

When named arguments not recognized by pomp are provided, these are made available to all basic components via the so-called userdata facility. This allows the user to pass information to the basic components outside of the usual routes of covariates (covar) and model parameters (params). See ?userdata for information on how to use this facility.

verbose

logical; if TRUE, diagnostic messages will be printed to the console.

Value

An object of class ‘bsmcd_pomp’. The following methods are avaiable:

plot

produces diagnostic plots

as.data.frame

puts the prior and posterior samples into a data frame

Note for Windows users

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 cdir and 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.

Details

bsmc2 uses a version of the original algorithm (Liu \& West 2001), but discards the auxiliary particle filter. The modification appears to give superior performance for the same amount of effort.

Samples from the prior distribution are drawn using the rprior component. This is allowed to depend on elements of params, i.e., some of the elements of params can be treated as “hyperparameters”. Np draws are made from the prior distribution.

References

Liu, J. and M. West. Combining Parameter and State Estimation in Simulation-Based Filtering. In A. Doucet, N. de Freitas, and N. J. Gordon, editors, Sequential Monte Carlo Methods in Practice, pages 197-224. Springer, New York, 2001.

See Also

More on particle-filter based methods in pomp: cond.logLik(), eff.sample.size(), filter.mean(), filter.traj(), kalman, mif2(), pfilter(), pmcmc(), pred.mean(), pred.var(), saved.states(), wpfilter()

More on pomp estimation algorithms: abc(), estimation_algorithms, kalman, mif2(), nlf, pmcmc(), pomp-package, probe.match, spect.match