Edward Lavender*
*This repository is maintained by Edward Lavender (edward.lavender@eawag.ch).
This repository reconstructs movement patterns of a Critically
Endangered elasmobranch in a passive acoustic telemetry system. In
2016–17, we tagged flapper skate (Dipturus intermedius) with acoustic
and archival tags in a Marine Protected Area (MPA) off the west coast of
Scotland as part of the Movement Ecology of Flapper Skate (MEFS)
project. In 2023, we developed a process-based framework for
reconstructing movement patterns and patterns of space use, motivated by
our work in this system (Lavender et al.,
2023). More recently, we
refined this framework, formalising the methodology in the language of
state-space modelling, with model inference implemented using particle
algorithms (Lavender et al.,
2024). We developed the
patter
package to support
its application (Lavender et al.,
2024). The package is
implemented in R and wraps a
high-performance Julia backend. In this
repository, we apply the methodology to reconstruct movements, patterns
of space use and residency exhibited by tagged individuals in relation
to the management zones within the MPA.
Methods are written in R and organised as an RStudio Project. Key elements of the workflow include:
- Data processing. We collate data from tagged animals and process
data as required by the
patter
package. - Simulations. We conduct a simulation-based analysis to evaluate algorithm performance, sensitivity and reproducibility.
- Real-world analyses. We analyse real-world movement patterns from tagged flapper skate.
The project was built in R (version 4.4.2)
in RStudio and implements local dependency
management using
renv
.
The project follows a standardised structure encouraged by the
dv
package. The high-level
structure was generated via dv::use_template_proj()
. The contents as
follows:
-
data-raw/
contains ‘raw’ data:bathymetry/
contains bathymetry data for the study area, from Howe et al. (2015), Admiralty and Digimap;boundaries/
contains boundaries of the study site, fromprocess-data-spatial-*.R
;coast/
contains coastline data, from Digimap;movement/
contains raw movement datasets, from the MEFS project and Skatespotter;mpa/
contains MPA boundary data, from J. Thorburn;
-
data/
contains processed data and results:graphics/
contains graphical settings (recorded by scripts);input/
contains algorithm inputs;inst/
contains RStudio Project-management files generated bydv
:dependencies.rds
is a list of dependencies;session-info.rds
is a record of information about the R Session;tree.rds
is a record of the project directory tree;
output/
contains algorithm outputs;spatial/
contains processed spatial datasets (seeprocess-data-spatial-*.R
);
-
dev/
contains project-management scripts.01-dev.R
and02-clone.R
are standarddv
scripts:01-dev.R
records project set up and development;02-clone.R
is used to clone the project (see ‘Instructions’);*-cluster-*.R
scripts support local cluster setup and management;
-
bin/
contains bash scripts. -
R/
contains R scripts for data processing and analysis:process-*
scripts implement data processing:process-data-spatial-*.R
scripts process spatial data;process-data-mefs-*.R
scripts process MEFS data;
explore-*
scripts implement data exploration;explore-data-mefs-*.R
scripts explore the MEFS data;
formulate-models.R
formulates models;simulate algorithms.R
runs simulations;prepare-*.R
scripts prepare real-world analyses:prepare-runs
prepares iteration datasets;prepare-xinit-*.R
prepares initial locations;
run-*
scripts run real-world analyses:run-coa.R
runs the COA algorithm;run-rsp.R
runs the RSP algorithm;run-patter-trials.R
trialspatter
’s algorithms;run-patter.R
- runspatter
’s algorithmsrun-patter-reanalysis.R
runs a reanalysis;synthesis.R
synthesises results from real-world analyses;
-
src/
contains supporting R functions. -
renv/
implements local dependency management. -
Julia/
houses the Julia project. -
fig/
contains figures. -
doc/
contains supporting documents.
Note that the data-raw/
, data/
(except data/inst/
), fig/
and
doc
directories are not provided in the online version of this
repository.
Follow the steps described below to clone the project and reproduce the workflow.
-
Contact us. Please get in touch if you would like to reproduce the workflow in full. We are unable to publish all raw datasets openly here due to copyright and third-party restrictions. Digimap datasets are subject to copyright restrictions and acoustic and archival belong to NatureScot and Marine Scotland Science. In addition, in this project, acoustic and archival data were sourced from the
MEFS
R package, which requires authentication for access. -
Clone the project via GitHub. Follow the instructions in
dev/02-clone.R
to install packages and directories:- Packages. Work through
dev/02-clone.R
to userenv
to regenerate the local project library. Packages can also be manually reinstalled via02-clone.R
. Contact us for the development versions of R and Julia libraries. Authentication is required forMEFS
. - Directories. Rebuild the project directory tree, via
dv::use_template_proj()
anddv::use_template_tree()
.
- Packages. Work through
-
Source project files (namely, raw data) from the authors.
-
Implement scripts in the order provided.
-
Warnings:
Howe, J. et al. (2014). The seabed geomorphology and geological structure of the Firth of Lorn, western Scotland, UK, as revealed by multibeam echo-sounder survey. Earth and Environmental Science Transactions of the Royal Society of Edinburgh, 105(4), 273–284. https://doi.org/10.1017/S1755691015000146
Lavender, E. et al. (2023). An integrative modelling framework for passive acoustic telemetry. Methods in Ecology and Evolution, 14, 2626–2638. https://doi.org/10.1111/2041-210X.14193
Lavender, E. et al. (2024a). Particle algorithms for animal movement modelling in autonomous receiver networks. bioRxiv, https://doi.org/10.1101/2024.09.16.613223
Lavender, E. et al. (2024b). patter: particle algorithms for animal tracking in R and Julia. bioRxiv, https://doi.org/10.1101/2024.07.30.605733
Lavender, E., Scheidegger, A., Albert, C., Biber, S. W., Brodersen, J., Aleynik, D., Cole, G., Dodd, J., Wright, P. J., Illian, J., James, M., Smout, S., Thorburn, J., & Moor, H. (2025). Animal tracking with particle algorithms for conservation. bioRxiv. https://doi.org/10.1101/2025.02.13.638042
Please note that this project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.