Description Usage Arguments Value Methods Filtering failures Author(s) References See Also Examples
A plain vanilla sequential Monte Carlo (particle filter) algorithm. Resampling is performed at each observation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## S4 method for signature 'data.frame'
pfilter(data, Np, tol = 1e-17, max.fail = Inf,
params, rinit, rprocess, dmeasure, pred.mean = FALSE,
pred.var = FALSE, filter.mean = FALSE, filter.traj = FALSE,
save.states = FALSE, ..., verbose = getOption("verbose", FALSE))
## S4 method for signature 'pomp'
pfilter(data, Np, tol = 1e-17, max.fail = Inf,
pred.mean = FALSE, pred.var = FALSE, filter.mean = FALSE,
filter.traj = FALSE, save.states = FALSE, ...,
verbose = getOption("verbose", FALSE))
## S4 method for signature 'pfilterd_pomp'
pfilter(data, Np, tol, ...,
verbose = getOption("verbose", FALSE))
## S4 method for signature 'objfun'
pfilter(data, ...)
|
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 length(time(object,t0=TRUE)) or as a function taking a positive integer argument.
In the latter case, |
tol |
positive numeric scalar;
particles with likelihood less than |
max.fail |
integer; the maximum number of filtering failures allowed (see below).
If the number of filtering failures exceeds this number, execution will terminate with an error.
By default, |
params |
optional; named numeric vector of parameters.
This will be coerced internally to storage mode |
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 |
rprocess |
simulator of the latent state process, specified using one of the rprocess plugins.
Setting |
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 |
pred.mean |
logical; if |
pred.var |
logical; if |
filter.mean |
logical; if |
filter.traj |
logical; if |
save.states |
logical.
If |
... |
additional arguments supply new or modify existing model characteristics or components.
See When named arguments not recognized by |
verbose |
logical; if |
An object of class ‘pfilterd_pomp’, which extends class ‘pomp’.
the estimated log likelihood
the estimated conditional log likelihood
the (time-dependent) estimated effective sample size
the mean and variance of the approximate prediction distribution
the mean of the filtering distribution
retrieve one sample from the smoothing distribution
coerce to a data frame
diagnostic plots
If the degree of disagreement between model and data becomes sufficiently large, a “filtering failure” results.
A filtering failure occurs when, at some time point, none of the Np
particles is compatible with the data.
In particular, if the conditional likelihood of a particle at any time is below the tolerance value tol
, then that particle is considered to be uninformative and its likelihood is taken to be zero.
A filtering failure occurs when this is the case for all particles.
A warning is generated when this occurs unless the cumulative number of failures exceeds max.fail
, in which case an error is generated.
Aaron A. King
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.
Other elementary POMP methods: pomp2-package
,
probe
, simulate
,
spect
Other particle filter methods: bsmc2
,
cond.logLik
, eff.sample.size
,
filter.mean
, filter.traj
,
mif2
, pmcmc
,
pred.mean
, pred.var
1 2 3 4 5 6 7 8 9 10 11 12 | pf <- pfilter(gompertz(),Np=1000) ## use 1000 particles
plot(pf)
logLik(pf)
cond.logLik(pf) ## conditional log-likelihoods
eff.sample.size(pf) ## effective sample size
logLik(pfilter(pf)) ## run it again with 1000 particles
## run it again with 2000 particles
pf <- pfilter(pf,Np=2000,filter.mean=TRUE,filter.traj=TRUE)
fm <- filter.mean(pf) ## extract the filtering means
ft <- filter.traj(pf) ## one draw from the smoothing distribution
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.