patter provides particle filtering, smoothing and sampling algorithms for animal movement modelling, with a focus on passive acoustic telemetry systems. This wraps and enhances a fast Julia backend (Patter.jl). The methodology enables the reconstruction of movement paths and patterns of space use. patter unifies a suite of methods formerly known as the flapper algorithms and supersedes the experimental flapper package (Lavender et al., 2023).
Vignettes
For an introduction to patter, use:
vignette("a-methodology", package = "patter")for a conceptual introduction to the methodology;vignette("b-workflow-outline", package = "patter")for an overview of the workflow;
For a full list of all functions, see help(package = 'patter').
For a glossary of key arguments, see glossary.
Datasets
For example datasets from the Movement Ecology of Flapper Skate project (datasets-mefs), which inspired patter, see:
dat_mooringsfor acoustic receiver deployments;dat_detectionsfor acoustic detection time series;dat_archivalfor archival (depth) time series;dat_gebco()for a bathymetry grid;dat_coast()for a coastline vector;dat_mpa()for a Marine Protected Area boundary
To validate new datasets for use with patter, see pat_setup_data() and/or the assemble_*() function documentation.
For example algorithm outputs (datasets-algorithms), see:
dat_path()for an example output fromsim_path_walk();dat_pff()anddat_pfb()for an example output frompf_filter();dat_tff()for an example output frompf_smoother_two_filter();
Set up Julia
To link patter and the Patter.jl Julia backend, use:
julia_connect()to connect toRtoJulia;julia_validate()to validate theR—Juliaconnection;set_seed()to set the seed inRandJulia;set_map()to make aterra::SpatRasterof the study area available inJulia;
These functions should be run at the start of every R session.
Simulation
To simulate animal movement time series, see:
sim_path_walk()to simulate a movement path from a walk model (viaModelMove);sim_array()to simulate an acoustic array;sim_observations()to simulate observational time series (viaModelObs);
To evaluate model skill in reconstructing simulated patterns, see skill_*() functions:
skill_mb()to calculate mean bias;skill_me()to calculate mean error;skill_rmse()to calculate root mean squared error;skill_R()to calculate Spearman's rank correlation coefficient;skill_d()to calculate the index of agreement;
Data exploration
For help with data acquisition, processing, checking and preliminary analyses, see the flapper package. This facilitates:
Data preparation;
Spatial operations;
Distance calculations;
Movement analyses;
Please submit a feature request if you would like functions from flapper in patter.
Algorithms
The main thrust of patter is the provision of fast, integrated modelling workflow based on particle filtering for reconstructing animal movement paths and emergent patterns of space use from observational time series (with a focus on passive acoustic telemetry systems).
To assemble datasets for particle filtering, use assemble_*() functions:
assemble_timeline()assembles a timeline;assemble_acoustics()assembles an acoustic time series;assemble_acoustics_containers()assembles a corresponding time series of acoustic containers;assemble_archival()assembles an archival time series;assemble_custom()assembles custom time series;
Ancillary time series should be structured in the same way for inclusion in the particle filter.
To implement particle filtering (PF) routines, use:
pf_filter()to implement the particle filter;pf_smoother_two_filter()to implement the two-filter smoother;
These functions return pf_particles objects.
For convenience plotting functions, see:
plot_xyt()to plot particle locations;
For mapping utilisation distributions, use:
map_pou()to map probability-of-use;map_dens()to create smooth maps usingspatstat, plus the supporting functions:as.im.SpatRaster(), to convertSpatRasters to pixel images;as.owin.SpatRaster(), to convertSpatRasters to observation windows;as.owin.sf(), to convertsfobjects to observation windows;
map_hr_*()to map home ranges, specifically:map_hr_prop()for a custom range;map_hr_core()for the 'core' range;map_hr_home()for the 'home' range;map_hr_full()for the full range;
Miscellaneous
See
cl_lapply()forRparallelisation;See
example_setup()for functions used to streamline examples;See
file_*()functions (e.g.,file_list()) for system file helpers;
References
Lavender, E. et al. (2023). An integrative modelling framework for passive acoustic telemetry. Methods in Ecology and Evolution. https://doi.org/10.1111/2041-210X.14193.
See also
For information on the
flapperalgorithms, see Lavender et al. (2023).For information on
patter's predecessor, see https://github.com/edwardlavender/flapper.For further information on
patter, including useful resources, see https://github.com/edwardlavender/patter.For support, feature requests and bug reports, raise an issue at https://github.com/edwardlavender/patter/issues.
For the
Juliabackend, see https://edwardlavender.github.io/Patter.jl.
Author
Edward Lavender (ORCID)
