An S3-class that defines the named list returned by pf_filter() and pf_smoother_two_filter().
Structure
pf_particles is a label used to denote outputs from selected functions in patter. The structure of this class is not strictly defined and primarily exists to streamline documentation. At the time of writing, pf_particles objects may comprise the following elements:
states—NULLor adata.table::data.tableof simulated states;diagnostics—Adata.table::data.tableof diagnostic statistics;callstats—Adata.table::data.tableof call statistics;
states
Unless, .batch is specified in pf_filter() and pf_smoother_two_filter(), states is a data.table::data.table that defines simulated particle states, with the following columns:
path_id—Anintegervector that defines the particle index;timestep—Anintegervector that defines the time step;timestamp—APOSIXctvector of time stamps;Additional columns with the values of each state dimension (e.g.,
map_value,x,y);
Particles are equally weighted, as the .n_record particles recorded at each time step are selected by resampling (see pf_filter()).
If the .batch is specified, states is NULL.
diagnostics
diagnostics is a data.table::data.table that stores diagnostic statistics for each time step. This includes timestep, timestamp and the following columns:
ess—Anumericvector that defines the effective sample size;maxlp—Anumericvector that defines the maximum log posterior;
callstats
callstats is a one-row data.table::data.table that stores call statistics for the function call. This includes the following columns:
timestamp—APOSIXctvalue that defines the start time of the function call;routine—Acharactervector that defines the routine:"filter: forward";"filter: backward";"smoother: two-filter";
n_particle—Anintegerthat defines the number of particles;n_iter—Anintegerthat defines the number of iterations (trials);error—Acharactervector of error message(s);loglik—Adoublethat defines the log likelihood of the observations given the parameters:For
pf_filter(),loglikis computed (ifconvergence = FALSE,loglik = -Inf);For
pf_smoother_two_filter(),loglikisNA_real_;
convergence—Alogicalvariable that defines whether or not the algorithm convergedFor
pf_filter(), convergence isTRUEif the filter reaches the end of the time series;For
pf_smoother_two_filter(), convergence is set toTRUEif proper smoothing is possible on at least 95 % of time steps; i.e., if 95 % ofdiagnostics$essvalues are notNaN(seePatter.particle_smoother_two_filter());
time—Anumericvalue that defines the duration (s) of the function call;
See also
Particle filters and smoothers sample states (particles) that represent the possible locations of an individual through time, accounting for all data and the individual's movement.
To simulate artificial datasets, see
sim_*()functions (especiallysim_path_walk(),sim_array()andsim_observations()).To assemble real-world datasets for the filter, see
assemble_*()functions.pf_filter()runs the filter:To run particle smoothing, use
pf_smoother_two_filter().To map emergent patterns of space use, use a
map_*()function (such asmap_pou(),map_dens()andmap_hr()).
