Edward Lavender1,2*
1 Scottish Oceans Institute, University of St Andrews,
Scotland
2 Centre for Research into Ecological and Environmental
Modelling, University of St Andrews, Scotland
* This repository is maintained by Edward Lavender ([email protected]).
The flapper
family of algorithms is a suite of mechanistic approaches
designed to reconstruct fine-scale movement paths and emergent patterns
of space use from discrete detections in passive acoustic telemetry
arrays. This repository illustrates applications of these algorithms
using simulated datasets. The performance and sensitivity of alternative
methods is compared in terms of how well they recover simulated patterns
of space use under different circumstances (e.g., passive acoustic
telemetry array designs).
Figure 1. Example outputs of the flapper_sim
project showing a
simulated array and movement path alongside patterns of space use
reconstructed by different algorithms.
Simulations and analyses are written in R
and organised as an
RStudio Project
with {renv}
. For data simulation, processing and
analysis, the flapper
R
package is required. For visualisation,
prettyGraphics
is
used, which is a dependency in
flapper
. For quick data
summaries, the
utils.add
package is
used on a few occasions.
-
R/
contains scripts for data simulation and analysis.-
helper.R
contains set up code and defines helper functions. -
sim_data.R
simulates data for analysis:- Array designs are simulated using
flapper::sim_array()
; - Movement paths are simulated using
flapper::sim_path_sa()
; - For each movement path and array design, observations arising
from movement—namely, detections at receivers—are simulated via
flapper::sim_detections()
; - A directory system within
data
(see below), within which results from the analyses of these simulated data are stored, is also set up;
- Array designs are simulated using
-
sim_workhorse.R
provides methods for implementing theflapper
family of algorithms to simulated data (using both ‘correct’ and ‘mis-specified’ parameters). -
sim_implement.R
is a wrapper that, for each simulated movement path, array design and set of algorithm parameters, implementssim_workhorse
to generate outputs. -
sim_illustrate.R
illustrates the main outputs of theflapper
family of algorithms. -
sim_evaluate.R
andsim_evaluate_spatstat.R
evaluate the performance of theflapper
family of algorithms, when applied ‘correctly’, in different array designs andsim_evaluate_wall_time.R
calculates the wall time for the simulations. -
sim_sensitivity.R
examines the sensitivity of theflapper
algorithms applied using different parameter ‘estimates’.
-
-
data/
contains data for the project. -
fig/
contains figures.
Note that data/
and fig/
are not included in the online version of
this repository.
-
Open the
RStudio Project
and use{renv}
to restore the local project library. -
Run
sim_data.R
to simulate datasets, customising the array designs and movement path parameters as necessary*. -
Implement algorithms for a specific movement path, array and parameter set via
sim_workhorse.R
or for all movement paths, array designs and parameter sets viasim_implement.R
*. Note that for the former, the movement path, array ID and parameter set need to be specified at the top of the script. -
Evaluate algorithm outputs when applied ‘correctly’ via
sim_illustrate.R
,sim_evaluate.R
,sim_evaluate_spatstat.R
andsim_evaluate_wall_time.R
. -
Examine algorithm sensitivity via
sim_sensitivity.R
. -
Examine outputs in
data/
andfig/
, such as the example figure below.
*For the first implementation of this project, ensure that all sections
that create data are set to TRUE
rather than FALSE
(in which case
previously created files are loaded and used for analysis).
Figure 2. An example comparison of methods for reconstructing simulated
patterns of movement and space use, derived from an application of the
flapper_sim
project.
This repository uses a number of non-default packages, available from
The Comprehensive R Archive Network. These
can be installed with install.packages()
. Three packages that are only
available on GitHub are also used:
flapper
. This package provides tools for the simulation, processing and analysis of passive acoustic telemetry data, including theflapper
family of algorithms.prettyGraphics
. This package is used for plotting.utils.add
. Theutils.add::basic_stats()
function is sometimes used as a convenient routine for summarising data. This could be replaced by baseR
functions, such assummary()
.
Lavender et al. (in press). A semi-stochastic modelling framework for passive acoustic telemetry. Methods in Ecology and Evolution.