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
patter
package vialibrary(patter)
.Connect to
Julia
viajulia_connect()
.Set the seed in
R
andJulia
viaset_seed()
.
Preparation
Prepare study area
-
Define a
terra::SpatRaster
map of the study area:- In our applications, the map is a bathymetry
SpatRaster
(see?dat_gebco
and?glossary
); - Mask inhospitable habitats (e.g., land) using
NA
s; - Export the map to
Julia
viaset_map()
;
- In our applications, the map is a bathymetry
Prepare movement model
-
Define the
State
type:-
State
defines the components of the animal’s movement that you want to track; - For example, if you want to track
x
andy
locations, useStateXY
;
-
-
Define a corresponding movement model (
ModelMove
) instance:- The movement model defines the animal’s movement capacity;
- See
?ModelMove
for built-in options and instructions for custom sub-types;
Prepare observations
-
Define observational datasets:
-
patter
should be able to work with any kind of observational dataset; - See
datasets-mefs
for example datasets included in the package;
-
-
Validate datasets:
- Datasets used in
patter
require 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,
patter
provides 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
?ModelObs
for 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_*()
;