Tools for applying particle filtering algorithms to panel data.
# S4 method for panelPomp
pfilter(
data,
shared,
specific,
params,
Np,
verbose = getOption("verbose"),
...
)# S4 method for pfilterd.ppomp
logLik(object, ...)
# S4 method for pfilterd.ppomp
unitLogLik(object, ...)
pfilter() returns an object of class pfilterd.ppomp that is also
a panelPomp object (with the additional filtering details).
When applied to an object of class pfilterd.ppomp, logLik()
returns a numeric value.
When given objects of class pfilterd.ppomp, unitLoglik() returns a numeric vector.
An object of class panelPomp or inheriting class
panelPomp.
optional; these arguments depend on the type
of object.
If object is a list of pomps, shared must be a
numeric vector specifying parameter values shared among panel units.
specific must be a matrix with parameter values that are
unit-specific with rows naming parameters and columns naming units (these
names must match those of object). If no values are specified and
object has parameter values, these are set to be all unit-specific.
If object is a panelPomp object, these arguments can still be
used as described above to modify the parameters of object.
Alternatively, the parameter configuration of object can be modified
providing only a character shared naming parameters of object
that should be shared (with values for parameters not originally shared
taken from the unit-specific parameters of the first panel unit of
object). shared=NULL sets all parameters as unit-specific.
optional; a named numeric vector. In this case, the nature of
parameters is determined via a naming convention: names ending in
“[unit_name]” are assumed to denote unit-specific parameters;
all other names specify shared parameters.
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.
logical; if TRUE, diagnostic messages will be printed to the console.
additional arguments, passed to the pfilter method of pomp.
required; either (i) a list of pomp objects; or
(ii) an object of class panelPomp or inheriting class
panelPomp.
If object is a list of pomps, the list must be named.
All these pomps must either have no parameters or have the same
parameter names. (This is just a format requirement. pomp codes can
ignore any parameter that is irrelevant to any given panel unit.)
If object is a panelPomp object, the function allows modifying
the shared and unit-specific configuration of object.
Extracts the estimated log likelihood for the entire panel.
Extracts the estimated log likelihood for each panel unit.
Carles Bretó
Arulampalam, M. S., Maskell, S., Gordon, N. and Clapp, T. (2002) A Tutorial on Particle Filters for Online Nonlinear/Non-Gaussian Bayesian Tracking. IEEE Trans. Sig. Proc., 50(2), 174--188. tools:::Rd_expr_doi("https://doi.org/10.1109/78.978374")
Bretó, C., Ionides, E. L. and King, A. A. (2020) Panel Data Analysis via Mechanistic Models. Journal of the American Statistical Association, 115(531), 1178--1188. tools:::Rd_expr_doi("https://doi.org/10.1080/01621459.2019.1604367")
pomp's pfilter at pfilter, panel_loglik
Other panelPomp workhorse functions:
mif2(),
panelPomp,
panel_loglik
# filter, which generates log likelihoods
pfrw <- pfilter(panelRandomWalk(),Np=10)
class(pfrw) # "pfilterd.ppomp"
is(pfrw,"panelPomp") # TRUE
pfrw
# extract single log likelihood for the entire panel
logLik(pfrw)
# extract log likelihood for each panel unit
unitLogLik(pfrw)
Run the code above in your browser using DataLab