Edward Lavender*
*This repository is maintained by Edward Lavender (edward.lavender@eawag.ch).
This repository contains methods, written in
R and organised as an
RStudio
Project, supporting our
analyses of lake trout (Salvelinus namaycush) movements in the Lake
Champlain passive acoustic telemetry system (North America). This work
builds on Futia et al.’s
(2024) heuristic analysis
of regional residency patterns. We use a state-space model approach. We
perform model-based inference using particle algorithms via the
patter
R and
Patter.jl
Julia packages.
The key elements of the workflow are as follows:
- State-space model formulation.
- Formulate a movement model for lake trout;
- Formulate an acoustic observation model for Lake Champlain;
- Simulation analyses.
- Simulate trajectories using the lake trout movement model;
- Simulate observations arising from trajectories using the Lake Champlain acoustic observation model;
- Examine the performance and sensitivity of particle algorithms applied to simulated observations;
- Real-world analyses.
- Analyse real-world time series using particle algorithms;
The project was built in R (version
4.5.x) in RStudio and implements local
dependency management using
renv. This can be
used to regenerate the local project library (see Instructions).
The main elements of the project structure are as follows:
-
bin/contains bash scripts (for code deployment on a server). -
data-raw/contains raw datasets*. This includes:mfutia/: lake trout datasets;model-move/: supporting movement datasets, used to inform the movement model;model-obs/: supporting range testing datasets, used to inform the acoustic observation model;
-
data/contains processed datasets, algorithm inputs and outputs, generated by*.Rand*.jlscripts*. This includes:input/include input data for analyses, including:map.tif: a map of the study area;real/: additional inputs for real-world analyses (e.g. processed detection data);sim/: additional inputs for simulation analyses;
inst/contains RStudio Project-management files generated byproj.templates:dependencies.rds: a list of dependencies;session-info.rds: a record of information about theRSession;tree.rds: a record of the project directory tree (as generated byproj.templates::use_template_tree()indev/01-dev.R, see below);
output/contains outputs from analyses, including:real/: outputs from real-world analyses;sim/: outputs from simulation analyses;
supp/contains supporting datasets, used for model development;
-
dev/contains project-management scripts.001-dev.Rand002-clone.Rare standardproj.templatesscripts:001-dev.Rrecords project set up and development;002-clone.Ris used to clone the project (see ‘Instructions’);
003-clean.Rand004-rebuildsupport project maintenance:003-clean.Rcleans and rebuilds thedata/directory;004-rebuild.Rre-runs selectedRscripts, populatingdata/;
-
doc/contains documents*. -
fig/contains figures*. -
Julia/is theJuliaproject directory. This includes:sim-data.jlsimulates trajectories and observations;run-filter.jlruns the particle filter to evaluate convergence;run-algorithms.jlruns the particle algorithms;
-
R/containsRscripts:setup-data-map.Rdefines a map of the study area;setup-data-detection.Rprocesses detection data;setup-data-move-*.Rprocesses movement (e.g., accelerometer) datasets, used to develop the movement model;setup-data-detection-pr-*.Rprocesses detection probability data, used to inform the acoustic observation model;develop-model-move-*.Ranalyses movement datasets and develops the movement model;develop-model-detection-pr-*.Ranalyses detection probability datasets and develops the acoustic observation model;develop-model.Rcollates state-space model parameters;sim-data.Rsimulates trajectories and observations;explore-data.Rexplores datasets;run-heuristic.Rruns a heuristic algorithm;prepare-analysis.Rprepares iterationdata.tables and directories for simulation/real-world analyses usingpatter;- (deprecated)
trial-patter*.Rexplored the use ofpatterto analyse simulation/real-world datasets; - (deprecated)
plan-patter.Rsupported the development of an implementation strategy; monitor-patter.Rmonitors algorithm progress;synthesise-patter.Rcollatespatteroutputs;analysis-patter-*.Ranalyse outputs;refine-patter.Rinteractively examines convergence failures;exports.Rexports selected datasets for related projects;
-
renv/implements local dependency management forR. -
src/containsRsource code.
These directories are not currently available in the online version of this repository*.
Follow the steps described below to clone the project and reproduce the workflow.
-
Clone the project via GitHub.
-
Setup project, following the instructions in
dev/002-clone.R:- Packages. Work through
dev/002-clone.Rto userenvto regenerate the local project library. Packages can also be manually reinstalled via002-clone.R, if required. - Directories. Rebuild the project directory tree, via
proj.templates::use_template_tree().
- Packages. Work through
-
Source
data-raw/from the sources provided or the authors. -
Run scripts to reproduce the analyses:
- Run
setup-,develop-,sim-andexplore-.Rscripts to set up the project; - Using
tmuxor similar, execute001-workflow.shto perform inference viarun-algorithms.jl; - Monitor algorithm process via
monitor-patter.R; - Synthesise and analyse outputs via
synthesise-*andanalyse-*.Rscripts;
- Run
Lavender, E. et al. (in prep). Big data analysis of animal movements in aquatic ecosystems with acoustic telemetry.
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.