This vignette lists the steps required to use patter to
reconstruct movements and patterns of space use. Use it as a reference.
See package documentation, such as the README, for
streamlined example workflow(s). See the patter-flapper
project for a complete, real-world analysis.
Set up
Load the
patterpackage vialibrary(patter).Connect to
Juliaviajulia_connect().Set the seed in
RandJuliaviaset_seed().
Preparation
Prepare study area
-
Define a
terra::SpatRastermap of the study area:- In our applications, the map is a bathymetry
SpatRaster(see?dat_gebcoand?glossary); - Mask inhospitable habitats (e.g., land) using
NAs; - Export the map to
Juliaviaset_map();
- In our applications, the map is a bathymetry
Prepare movement model
-
Define the
Statetype:-
Statedefines the components of the animal’s movement that you want to track; - For example, if you want to track
xandylocations, useStateXY;
-
-
Define a corresponding movement model (
ModelMove) instance:- The movement model defines the animal’s movement capacity;
- See
?ModelMovefor built-in options and instructions for custom sub-types;
Prepare observations
-
Define observational datasets:
-
pattershould be able to work with any kind of observational dataset; - See
datasets-mefsfor example datasets included in the package;
-
-
Validate datasets:
- Datasets used in
patterrequire manual preparation for analysis; - Example considerations for passive acoustic telemetry data include:
- False detections
(e.g.
?glatos::false_detections()); - Detection timing;
- Receiver locations;
- False detections
(e.g.
- For passive acoustic telemetry and/or archival data,
patterprovides apat_setup_data()function which validates data format of these data types for use inpatter;
- Datasets used in
-
Define observation models (
ModelObs) sub-types:- Observation models link individual movements to the observations;
- See
?ModelObsfor built-in observation models and instructions for custom sub-types;
-
Collate observations and observation model parameters:
- Define a timeline of interest;
- Extract the observations for a particular individual;
- Observations should be arranged as
[
data.table::data.table]s in long-format; - For passive acoustic telemetry and archival datasets, use
pat_setup_data()andassemble_*()functions to assemble datasets as required; - Otherwise, see the
assemble_*()function documentation for straightforward dataset assembly instructions;
To simulate datasets instead, see
sim_*()functions;
Particle algorithms
Forward filter
- Implement the particle filter via
pf_filter():- This returns a
list, which includes astates[data.table::data.table] that defines the possible states (locations) of the individual at each time step (according to the movement model and the observations);
- This returns a
Two-filter smoother
Implement the particle filter forwards and backwards;
-
Implement the two-filter smoother via
pf_smoother_two_filter():- This refines outputs from the filter;
Mapping
Plot particle positions via
pf_plot_*();-
Map utilisation distributions:
- Map probability-of-use via
map_pou(); - Map smoothed probability density via
map_dens();
- Map probability-of-use via
Map home ranges via
map_hr_*();
