A sequential importance sampling (particle filter) algorithm.
Unlike in pfilter
, resampling is performed only when triggered by
deficiency in the effective sample size.
# S4 method for data.frame
wpfilter(
data,
Np,
params,
rinit,
rprocess,
dmeasure,
trigger = 1,
target = 0.5,
...,
verbose = getOption("verbose", FALSE)
)# S4 method for pomp
wpfilter(
data,
Np,
trigger = 1,
target = 0.5,
...,
verbose = getOption("verbose", FALSE)
)
# S4 method for wpfilterd_pomp
wpfilter(data, Np, trigger, target, ..., verbose = getOption("verbose", FALSE))
either a data frame holding the time series data, or an object of class ‘pomp’, i.e., the output of another pomp calculation.
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.
optional; named numeric vector of parameters.
This will be coerced internally to storage mode double
.
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.
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.
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.
numeric; if the effective sample size becomes smaller than trigger * Np
, resampling is triggered.
numeric; target power.
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.
logical; if TRUE
, diagnostic messages will be printed to the console.
An object of class ‘wpfilterd_pomp’, which extends class ‘pomp’. Information can be extracted from this object using the methods documented below.
logLik
the estimated log likelihood
cond.logLik
the estimated conditional log likelihood
eff.sample.size
the (time-dependent) estimated effective sample size
as.data.frame
coerce to a data frame
plot
diagnostic plots
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.
This function is experimental and should be considered in alpha stage. Both interface and underlying algorithms may change without warning at any time. Please explore the function and give feedback via the pomp Issues page.
M.S. Arulampalam, S. Maskell, N. Gordon, & T. Clapp. A tutorial on particle filters for online nonlinear, non-Gaussian Bayesian tracking. IEEE Transactions on Signal Processing 50, 174--188, 2002.
More on pomp elementary algorithms:
elementary_algorithms
,
pfilter()
,
pomp-package
,
probe()
,
simulate()
,
spect()
,
trajectory()
More on particle-filter based methods in pomp:
bsmc2()
,
cond.logLik()
,
eff.sample.size()
,
filter.mean()
,
filter.traj()
,
kalman
,
mif2()
,
pfilter()
,
pmcmc()
,
pred.mean()
,
pred.var()
,
saved.states()