Learn R Programming

pomp (version 0.30-1)

pfilter: Particle filter

Description

Run a plain vanilla particle filter. Resampling is performed at each observation.

Usage

pfilter(object, ...)
## S3 method for class 'pomp':
pfilter(object, params, Np, tol = 1e-17,
    max.fail = 0, pred.mean = FALSE, pred.var = FALSE,
    filter.mean = FALSE, save.states = FALSE, seed = NULL,
    verbose = getOption("verbose"), ...)
## S3 method for class 'mif':
pfilter(object, params, Np, tol = 1e-17,
    max.fail = 0, pred.mean = FALSE, pred.var = FALSE,
    filter.mean = FALSE, \dots)

Arguments

object
An object of class pomp or inheriting class pomp.
params
A npars x Np matrix containing the parameters corresponding to the initial state values in xstart. This must have a rownames attribute. It is permissible to supply params as a na
Np
integer; number of particles to use. When object is of class mif, this is by default the same number of particles used in the mif iterations.
tol
positive numeric scalar; particles with log likelihood below tol are considered to be lost. A filtering failure occurs when, at some time point, all particles are lost. When all particles are lost, the conditional log
max.fail
integer; the maximum number of filtering failures allowed. If the number of filtering failures exceeds this number, execution will terminate with an error.
pred.mean
logical; if TRUE, the prediction means are calculated for the state variables and parameters.
pred.var
logical; if TRUE, the prediction variances are calculated for the state variables and parameters.
filter.mean
logical; if TRUE, the filtering means are calculated for the state variables and parameters.
save.states
logical; if TRUE, the state-vector for each particle is saved and returned.
seed
optional; an object specifying if and how the random number generator should be initialized (seeded). If seed is an integer, it is passed to set.seed prior to any simulation and is returned as the see
verbose
logical; if TRUE, progress information is reported as pfilter works.
...
Additional arguments unused at present.

Value

  • A list with the following elements:
  • pred.meanThe matrix of prediction means. The rows correspond to states and parameters (if appropriate), in that order, the columns to successive observations in the time series contained in object.
  • pred.varThe matrix of prediction variances, in the same format as pred.mean.
  • filter.meanThe matrix of filtering means, in the same format as pred.mean.
  • eff.sample.sizeA vector containing the effective number of particles at each time point.
  • cond.loglikA vector containing the conditional log likelihoods at each time point.
  • statesIf saves.states=TRUE, the array of state-vectors at each time point, for each particle. An array with dimensions nvars-by-Np-by-ntimes. In particular, states[,i,t] can be considered a sample from $f[X|y_{1:t}]$.
  • seedThe state of the random number generator at the time pfilter was called. If the argument seed was specified, this is a copy; if not, this is the internal state of the random number generator at the time of call.
  • Np, tol, nfailThe number of particles used, failure tolerance, and number of filtering failures, respectively.
  • loglikThe estimated log-likelihood.

References

M. S. Arulampalam, S. Maskell, N. Gordon, & T. Clapp. A Tutorial on Particle Filters for Online Nonlinear, Non-Gaussian Bayesian Tracking. IEEE Trans. Sig. Proc. 50:174--188, 2002.

See Also

pomp-class

Examples

Run this code
## See the vignettes for examples.

Run the code above in your browser using DataLab