Title: Study Design Toolbox for Movement Ecology Studies
Version: 0.3.2
Maintainer: Inês Silva <i.simoes-silva@hzdr.de>
Description: Toolbox and 'shiny' application to help researchers design movement ecology studies, focusing on two key objectives: estimating home range areas, and estimating fine-scale movement behavior, specifically speed and distance traveled. It provides interactive simulations and methodological guidance to support study planning and decision-making. The application is described in Silva et al. (2023) <doi:10.1111/2041-210X.14153>.
License: GPL (≥ 3)
URL: https://ecoisilva.github.io/movedesign/, https://ecoisilva.r-universe.dev/movedesign
BugReports: https://github.com/ecoisilva/movedesign/issues
Depends: R (≥ 3.5.0)
Imports: bayestestR, bsplus, combinat, config (≥ 0.3.1), crayon, ctmm (≥ 0.6.1), data.table, dplyr, fontawesome, gdtools, ggiraph, ggplot2, ggpubr, ggtext, golem (≥ 0.3.2), grDevices, gsl, lubridate, parallel, parsedate, quarto, reactable, rintrojs, rlang, scales, shiny (≥ 1.7.1), shinyalert, shinybusy, shinydashboard, shinydashboardPlus, shinyFeedback, shinyjs, shinyWidgets, stats, stringr, terra, tidyr, utils, viridis
Suggests: knitr, rmarkdown, shinytest2
VignetteBuilder: knitr, quarto
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: true
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-07-29 15:22:03 UTC; simoes48
Author: Inês Silva ORCID iD [cre, aut, cph]
Repository: CRAN
Date/Publication: 2025-07-30 16:30:09 UTC

movedesign: Study design of movement ecology studies

Description

The movedesign package contains an R shiny application that assists researchers in designing movement ecology studies.

Author(s)

Maintainer: Inês Silva i.simoes-silva@hzdr.de (ORCID) [copyright holder]

See Also

Useful links:


Estimate home range from simulated movement data

Description

Estimates home range areas for each simulated movement dataset using the Autocorrelated Kernel Density Estimator (AKDE) via ctmm::akde(). This function is intended for use within simulation workflows where home range calculations are needed for each simulated individual.

Usage

estimate_hr(rv)

Arguments

rv

A reactiveValues list containing, at a minimum:

  • simList: A list of simulated movement datasets (e.g., telemetry tracks).

  • simfitList: A list of fitted movement models, each corresponding to an entry in simList.

Each movement dataset in simList should be compatible with ctmm::akde(), and each fitted model in simfitList should correspond to its respective simulated dataset.

Value

A named list of ctmm objects, each representing an AKDE home range estimate for the corresponding simulation. If AKDE estimation fails for a simulation (e.g., due to poor model fit or data issues), the result for that simulation will be NULL.

Note

This function is intended for internal use and may assume inputs follow specific structure and constraints not referenced explicitly.

See Also

ctmm::akde() for details on home range estimation.


Estimate movement speed for simulated movement data

Description

Calculates continuous-time speed and distance (CTSD) for each simulated movement dataset using its corresponding fitted movement model with ctmm::speed(). This function is designed for simulation workflows where speed metrics are required for each simulated individual.

Usage

estimate_speed(rv)

Arguments

rv

A reactiveValues list containing, at a minimum:

  • simList: A list of simulated movement datasets (e.g., telemetry tracks).

  • simfitList: A list of fitted movement models, each corresponding to an entry in simList.

Each element in simList should be compatible with ctmm::speed(), and each model in simfitList should correspond to its respective simulated dataset.

Value

A named list of speed estimates (ctmm objects), with one entry per simulation.For any simulation where speed estimation fails (e.g., due to model fitting issues or incompatible data), NULL is returned for that entry and omitted from the final output.

Note

This function is intended for internal use and may assume inputs follow specific structure and constraints not referenced explicitly.

See Also

ctmm::speed() for details on speed estimation.


Fit continuous-time movement models

Description

This function fits continuous-time movement models to simulated location data using the ctmm package. It estimates movement parameters for each simulated trajectory, optionally running in parallel for efficiency. It supports both home range and speed estimation workflows.

Usage

fitting_model(obj, set_target = c("hr", "ctsd"), ...)

Arguments

obj

A list of simulated movement datasets, each formatted as a telemetry object compatible with ctmm.

set_target

A character vector specifying the research goals. Options include:

  • "hr" — Home range estimation.

  • "ctsd" — Speed and distance estimation.

...

Optional control parameters passed via .... These include .dur, .dti, .tau_p, .tau_v, .error_m, .check_sampling, .rerun, .parallel, and .trace. See Details for their descriptions.

Details

The function generates initial parameter estimates for each dataset using ctmm::ctmm.guess(). If the data includes simulated location error, it uses an error model accordingly. When .check_sampling is TRUE, it compares the sampling duration and interval against optimal thresholds derived from the provided autocorrelation timescales. Models are fitted using ctmm::ctmm.select(), which performs model selection to find the best-fit movement process. If .rerun is enabled, the function identifies simulations with effective sample sizes below 0.1 and attempts to reselect models for those. Finally, all fitted models are recentered to (⁠0, 0⁠) for downstream consistency.

The following arguments can be supplied via ...:

Value

A list of fitted movement models (class ctmm), one per simulation. Each model is recentered to the origin (x = 0, y = 0).

Note

This function is intended for internal use and may assume inputs follow specific structure and constraints not referenced explicitly.

See Also

ctmm::ctmm.guess(), ctmm::ctmm.select()


Fix rates of animal tracking devices.

Description

A dataset listing typical GPS fix rates for animal tracking devices. Useful for selecting typical sampling schedules in wildlife tracking projects.

Usage

fixrates

Format

A data.frame with 40 rows and 7 variables:

dti_notes

Human-readable fix schedule, e.g., "1 fix every month". Helps interpret sampling intervals in practical terms.

dti

Sampling interval in seconds, i.e., time between consecutive location fixes.

frq

Sampling frequency in seconds, i.e., how often a fix occurs (inverse of dti).

frq_hrs

Sampling frequency in hours, offering a more intuitive unit for comparison.

highlighted

Logical. TRUE if the fix rate is commonly used in animal tracking studies. Useful for identifying standard settings.

...


Assess output convergence in simulation outputs

Description

Evaluates whether the cumulative mean of a tracked error metric in simulation outputs has stabilized, indicating convergence. This function helps determine if repeated simulations or resampling have produced stable estimates, which is critical for reliable inference in animal movement projects.

Use this function after running md_run() or md_replicate() to check the reliability of outputs before further interpretation or reporting.

Usage

md_check(
  obj,
  m = NULL,
  tol = 0.05,
  n_converge = 10,
  plot = TRUE,
  pal = c("#007d80", "#A12C3B")
)

Arguments

obj

A movedesign or related object returned by md_run() or md_replicate().

m

Numeric (optional). If provided, restricts the convergence check to results for a specific population sample size (m). Defaults to NULL, which checks up to the maximum population sample size.

tol

Numeric. The tolerance threshold for absolute change in the cumulative mean to declare convergence. Defaults to 0.05.

n_converge

Integer. Number of consecutive steps within tolerance required to confirm convergence. Defaults to 10.

plot

Logical. If TRUE (default), generates a plot of stepwise changes in the cumulative mean, highlighting when convergence is achieved.

pal

Character vector of color(s) of the plot, such as c("#007d80", "#A12C3B")) (default).

Details

The cumulative mean of error is calculated, and the absolute changes over the last n_converge steps are inspected. If all are below the specified tolerance, convergence is declared.

If plot = TRUE, a plot is shown of absolute stepwise change in the cumulative mean, with a shaded region indicating the convergence threshold, aiding visual assessment.

Value

An object of class "movedesign_check" with the following elements:

has_converged

Logical scalar indicating whether convergence was achieved.

recent_deltas

Numeric vector of absolute changes in cumulative mean over the last n_converge steps.

max_delta

Maximum absolute change among the last steps.

tolerance

Numeric, the input tolerance tol.

n_converge

Integer, the input n_converge.

variable

Character. Name of the variable checked.

recent_cummean

Numeric vector. The last cumulative means checked.

See Also

md_run(), md_replicate()

Examples

if(interactive()) {
  # After running a simulation or resampling:
  md_check(output, tol = 0.05, n_converge = 10)
}


Interactively configure movement design setup

Description

Guides the user to assign each argument required for a movement design workflow, including species label and key simulation settings. Users may choose to set a specific population sample size (number of animals tagged/to be tagged) or optimize the population sample size considering a specific analytical target.

Usage

md_configure(data, models = NULL)

Arguments

data

A named list of telemetry objects (from ctmm::as.telemetry()) to be used as the empirical basis for the simulations. Each telemetry object must contain valid metadata and timestamped locations.

models

(Optional) Named list of fitted ctmm models (from ctmm::ctmm.fit() or ctmm::ctmm.select()). If not supplied, models are fitted automatically.

Details

The argument data is required and must be supplied directly (as a list of telemetry objects, obtained from ctmm::as.telemetry()). The argument models is optional, and if omitted, models will be fitted automatically.

Value

An object of class movedesign_input (and movedesign). This is a structured S3 list containing all validated inputs, model fits, and derived parameters for the study design workflow.

See Also

md_prepare()

Examples

if(interactive()) {
  data(buffalo)
  md_params <- md_configure(data = buffalo)
}


Merge multiple simulation outputs

Description

Merges the results of multiple simulation runs, each produced by md_run(), into a single unified movedesign_output object. This is especially useful when running replicate simulations for power analyses, sensitivity testing, or batch processing. Merging allows you to aggregate all simulated individuals, outputs, and related metadata, enabling streamlined downstream analyses.

Usage

md_merge(...)

Arguments

...

One or more objects of class movedesign_preprocess, typically generated by md_run(). Each object must contain, at minimum, the elements simList, simfitList, and seedList. Optional elements such as akdeList and ctsdList are merged if present.

Value

A single movedesign_output object that contains all merged simulation outputs and inherits metadata from the first input object. The output includes:

See Also

md_prepare, md_run

Examples

if (interactive()) {
  input <- md_prepare(
    data = buffalo,
    models = models,
    species = "buffalo",
    n_individuals = 5,
    dur = list(value = 1, unit = "month"),
    dti = list(value = 1, unit = "day"),
    add_individual_variation = TRUE,
    grouped = FALSE,
    set_target = "hr",
    which_meta = "mean"
  )

  output1 <- md_run(input)
  output2 <- md_run(input)

  merged <- md_merge(output1, output2)
}


Optimize population sample size and sampling parameters

Description

Repeatedly simulates movement datasets across a range of candidate population sample sizes to identify the minimal sample size and associated sampling parameters (e.g., duration, sampling interval) required to achieve a predefined error threshold for key space-use and movement metrics (home range area, or speed).

The function quantifies estimation error for each metric and sample size, evaluates which population sample size reliably meets target thresholds, and reports final recommendations.

Usage

md_optimize(
  obj,
  n_replicates = NULL,
  error_threshold = NULL,
  verbose = FALSE,
  trace = TRUE,
  parallel = FALSE,
  ncores = parallel::detectCores(),
  plot = FALSE,
  ...
)

Arguments

obj

A movement design input object (see md_prepare() or md_configure()).

n_replicates

Integer. Number of simulation replicates at each candidate sample size.

error_threshold

Numeric. Error threshold (e.g. 0.05 for 5%) to display as a reference in the plot.

verbose

Logical. If TRUE (default), prints a summary of the convergence check to the console.

trace

Logical; if TRUE (default), prints progress and timing messages to the console.

parallel

Logical; if TRUE, enables parallel processing. Default is FALSE.

ncores

Integer; number of CPU cores to use for parallel processing. Defaults to all available cores detected by parallel::detectCores().

plot

Logical. If TRUE, displays a diagnostic plot of the final results.

...

Additional arguments used internally.

Details

The function iteratively runs movement design simulations for increasing population sample sizes (m), evaluating error for each replicate and metric via meta-analyses. Convergence is checked using the error threshold and stability of cumulative mean error. The function stops when a sample size meets all criteria or the maximum population sample size is reached. Results can be visualized using if plot = TRUE.

Value

A list of class movedesign_report containing:

Note

Some biologgers inherently involve a trade-off between fix frequency and battery life. Shorter intervals between location fixes offer higher temporal resolution but reduce deployment duration due to increased power consumption. In contrast, longer deployments require less frequent sampling to conserve battery.

This trade-off makes it challenging to estimate multiple metrics with differing data needs: high-resolution data (shorter intervals) improve speed estimation, while extended deployments (longer durations) are vital for accurate home range area estimates. A sampling design that minimizes error for one metric may increase error for another.

Researchers facing these constraints should consider prioritizing a single research target (e.g., either home range area or speed), or use stratified designs to balance data needs across individuals.

See Also

md_prepare(), md_configure()

Examples

if(interactive()) {
  obj <- md_configure(data = buffalo,
                      models = models)
                      
  out <- md_optimize(tmp,
                     n_replicates = 25,
                     error_threshold = 0.05,
                     plot = TRUE)
}


Visualize study design outputs

Description

Produces a publication-ready density plot showing the distribution of relative error estimates from study design simulations. The plot highlights the mean and a shaded credible interval (CI) region, following the computation of credible intervals as implemented in bayestestR::ci(). If groups are present, density curves for each group are overlaid for comparison, using customizable colors.

This function is typically used after running md_replicate(), providing a visual diagnostic of simulation results.

Usage

md_plot(
  obj,
  ci = 0.95,
  method = "HDI",
  pal = c("#007d80", "#A12C3B"),
  m = NULL
)

Arguments

obj

A movedesign_output object, as returned by md_replicate(). The object must contain a summary data frame with, at a minimum, the following columns:

error

Relative error values for each replicate.

error_lci

Lower credible interval bound for error.

error_uci

Upper credible interval bound for error.

group

(Optional) Group label for comparing densities.

ci

Numeric scalar between 0 and 1. The probability of the credible interval (CI) to be estimated. Default to 0.95 (95%).

method

Character. Credible interval estimation method (passed to bayestestR::ci(); default: "HDI"). See ?bayestestR::ci() for more details.

pal

Character vector of color(s) for the density, CI shading, and mean line. If a single group, supply one color (default: "#007d80"). If groups are present, supply two colors (default: c("#007d80", "#A12C3B")).

m

Numeric (optional). If provided, restricts the results for a specific population sample size (m). Defaults to NULL, which checks up to the maximum population sample size.

Details

This plot helps users assess the reliability of simulation outputs by visualizing the distribution of relative errors. When multiple groups are simulated, the plot enables direct visual comparison of performance across groups. If credible intervals cannot be calculated, a warning is issued and only the density curves are displayed.

It is strongly recommended to use md_check() to assess whether the distributions shown here have stabilized. Checking for convergence ensures that the summary statistics and uncertainty estimates depicted in the plot are reliable and not unduly influenced by too few replicates or ongoing variability. Running md_check() helps you determine if additional simulation replicates are needed to achieve stable inference in your design evaluation.

Value

A ggplot object showing:

This object can be further customized with additional ggplot2 layers if needed.

See Also

md_replicate(), md_check() for convergence diagnostics, and refer to bayestestR::ci() for details on credible interval computation and interpretation.

Examples

if (interactive()) {
  input <- md_prepare(
    data = buffalo,
    models = models,
    species = "buffalo",
    n_individuals = 5,
    dur = list(value = 1, unit = "month"),
    dti = list(value = 1, unit = "day"),
    add_individual_variation = TRUE,
    grouped = TRUE,
    set_target = "hr",
    which_meta = "mean"
  )

  output <- md_replicate(input, n_replicates = 20)

  # Plot with 80% credible intervals:
  md_plot(output, ci = 0.80, method = "HDI")
}


Preview plot for movedesign workflow outputs (single replicate)

Description

Generates a quick visualization of relative error for home range or movement speed estimation from a single replicate of a movedesign workflow. This functions shows preliminary outputs only and should not be used to evaluate study design.

Use the output of md_run() (a movedesign_preprocess object). Users should run md_replicate() for a full assessment.

Usage

md_plot_preview(obj, error_threshold = 0.05, pal = c("#007d80", "#A12C3B"))

Arguments

obj

An object of class movedesign_preprocess (output of md_run()).

error_threshold

Numeric. Error threshold (e.g. 0.05 for 5%) to display as a reference in the plot.

pal

Character vector of two colors for within/outside threshold (default: c("#007d80", "#A12C3B")).

Details

For robust results and credible intervals, use md_replicate().

Value

A ggplot object displaying relative error by population sample size, with point estimate and confidence intervals for mean estimates, and horizontal error threshold lines.

See Also

md_run(), md_replicate()

Examples

if (interactive()) {
  input <- md_prepare(
    data = buffalo,
    models = models,
    species = "buffalo",
    n_individuals = 5,
    dur = list(value = 1, unit = "month"),
    dti = list(value = 1, unit = "day"),
    add_individual_variation = TRUE,
    grouped = TRUE,
    set_target = "hr",
    which_meta = "mean"
  )

  output <- md_run(input)
  md_plot_preview(output, error_threshold = 0.05)
}


Prepare movement study design inputs

Description

Prepares, validates, and organizes all required inputs and parameters for evaluating the study design of animal movement projects. This function checks data inputs, fits or verifies movement models, extracts key parameters, and consolidates all settings in a structured object for easy and reproducible downstream use.

Usage

md_prepare(
  species = NULL,
  data,
  models = NULL,
  n_individuals = NULL,
  dur = NULL,
  dti = NULL,
  set_target = c("hr", "ctsd"),
  which_meta = "mean",
  add_individual_variation = FALSE,
  groups = NULL,
  parallel = FALSE
)

Arguments

species

Character. Scientific or common name of the focal species used as a workflow label.

data

A named list of telemetry objects (from ctmm::as.telemetry()) to be used as the empirical basis for the simulations. Each telemetry object must contain valid metadata and timestamped locations.

models

(Optional) Named list of fitted ctmm models (from ctmm::ctmm.fit() or ctmm::ctmm.select()). If not supplied, models are fitted automatically.

n_individuals

Integer. Number of animals (tags) to include in the study design; defines the target population sample size.

dur

A list with elements value and unit (e.g., list(value = 2, unit = "months")), for the study's maximum duration. unit must be either "second", "minute", "hour", "day", "month", or "year".

dti

A list with elements value and unit (e.g., list(value = 1, unit = "day")), specifying the intended sampling interval between relocations. unit must be either "second", "minute", "hour", "day", "month", or "year".

set_target

Character. Specifies the primary research target(s): must be either hr (home range estimation), ctsd (movement speed), or a character vector including both. This argument controls which target metrics are processed, analyzed, and reported in the study design workflow.

which_meta

Character. Specifies the analytical target for population-level inference: NULL, "mean" (default), or "ratio". Use NULL for a single individual, "mean" for population means, or "ratio" to compare group means (requires groups).

add_individual_variation

Logical. If TRUE, simulates variation by drawing movement parameters from the population distribution.

groups

(Optional) A named list for group assignments. Each element is a character vector of individual names (matching data). For example, list(A = c("id1", "id2"), B = c("id3", "id4")) for groups "A" and "B".Required when ⁠which_meta = \"ratio\"⁠.

parallel

Logical. If TRUE, enables parallel processing for model fitting, which speeds up analyses.

Details

This function is designed to streamline and standardize the preparation of input data and study design parameters for simulation-based movement ecology analyses. It performs the following key steps:

Value

An object of class movedesign_input (and movedesign). This is a structured S3 list containing all validated inputs, model fits, and derived parameters for the study design workflow.

The returned object includes:

This object is ready for use in downstream movedesign output and diagnostic functions.

Examples

if(interactive()) {
  data(buffalo)
  input <- md_prepare(
    data = buffalo,
    models = models,
    species = "buffalo",
    n_individuals = 5,
    dur = list(value = 1, unit = "month"),
    dti = list(value = 1, unit = "day"),
    add_individual_variation = TRUE,
    set_target = "hr",
    which_meta = "mean")
 summary(input)
}


Replicate study design and aggregate simulation outputs

Description

Runs the specified movement study design multiple times and aggregates outputs and summary statistics across independent replicates. This enables sensitivity analyses and quantifies variability arising from random sampling, especially when individual-level variation is enabled (i.e., add_individual_variation = TRUE in md_prepare()). Replication helps assess how stochasticity and design choices impact simulation inference.

Usage

md_replicate(
  obj,
  n_replicates,
  verbose = FALSE,
  trace = TRUE,
  parallel = FALSE,
  ncores = parallel::detectCores()
)

Arguments

obj

An object of class movedesign created by md_prepare(). It contains all parameters and input data defining the movement study.

n_replicates

Integer specifying how many independent simulation replicates to run.

verbose

Logical; if TRUE, runs population-level inferences iteratively for increasing population sample sizes, saving results at each step. Defaults to FALSE, which runs only once for the maximum sample size defined by n_individuals in md_prepare().

trace

Logical; if TRUE (default), prints progress and timing messages to the console.

parallel

Logical; if TRUE, enables parallel processing. Default is FALSE.

ncores

Integer; number of CPU cores to use for parallel processing. Defaults to all available cores detected by parallel::detectCores().

Details

Each replicate runs independently using the same study design object but with a unique random seed to ensure independence. Results from all replicates are merged using md_merge(), and summary statistics combine into a single data.table for convenient downstream analyses and evaluation. Parallel processing can significantly reduce runtime when running many replicates; use ncores to specify the number of CPU cores used. If function is interrupted (e.g., Ctrl+C), it returns results from all completed replicates up to that point.

Value

A list of class movedesign_output with two elements:

See Also

md_prepare(), md_run(), md_merge()

Examples

if (interactive()) {
  input <- md_prepare(
    data = buffalo,
    models = models,
    species = "buffalo",
    n_individuals = 5,
    dur = list(value = 1, unit = "month"),
    dti = list(value = 1, unit = "day"),
    add_individual_variation = TRUE,
    grouped = FALSE,
    set_target = "hr",
    which_meta = "mean"
  )

  output <- md_replicate(input, n_replicates = 5)
}


Run study design workflow

Description

Executes a complete simulation and analysis workflow for an animal movement study design prepared using md_prepare(). This function simulates telemetry data, fits movement models, estimates home ranges and/or movement speeds, and stores all results in the returned object. Progress and timing messages are printed by default.

Usage

md_run(design, trace = TRUE)

Arguments

design

An object of class movedesign (and movedesign_input), as returned by md_prepare(), containing all study design parameters and data.

trace

Logical. If TRUE (default), print progress and timing messages to the console.

Details

This function ensures reproducibility by saving all random seeds and intermediate results. Progress and timing messages help track the simulation workflow.

Typical workflow:

Value

An updated movedesign object (subclass movedesign_preprocess) containing all simulation and outputs components:

See Also

md_prepare(), md_replicate(), md_check(), md_plot()

Examples

if(interactive()) {
input <- md_prepare(
  data = buffalo,
  models = models,
  species = "buffalo",
  n_individuals = 5,
  dur = list(value = 1, unit = "month"),
  dti = list(value = 1, unit = "day"),
  add_individual_variation = TRUE,
  set_target = "hr",
  which_meta = "mean"
)
output <- md_run(input)
}


Create a movedesign_input object for simulation workflows

Description

Constructs an S3 object of class movedesign_input, encapsulating all parameters and metadata required for a simulation-based study design. This object includes elements such as number of individuals (population sample size), study duration, sampling interval, movement models, grouping structure (if specified), and estimation targets. The standardized movedesign_input object is the expected input for downstream movedesign functions.

Use md_prepare() to construct a complete study design input object, which can then be passed to functions like md_run() and md_replicate().

Usage

movedesign_input(design)

Arguments

design

A named list containing user-specified inputs for a movedesign workflow. At a minimum, this includes elements such as data, dur, dti, n_individuals, and set_target.

Value

An object of class movedesign_input and movedesign, which contains all input parameters and metadata required for a movedesign workflow.

See Also

md_prepare()


Create a movedesign_output object to store simulation outputs

Description

Constructs an S3 object of class movedesign_output that stores the outputs and summaries from a specific simulation workflow. The resulting object bundles all relevant metadata from the original study design (inputs), simulation outputs (e.g., home range or speed estimates), and post-processing summaries (e.g., errors, credible intervals).

The movedesign_output object is returned by simulation functions like md_run() or md_replicate(), and acts as the primary data structure for downstream analyses and visualization via functions such as md_plot() or md_check().

Usage

movedesign_output(input)

Value

An S3 object of class movedesign_output containing simulation outputs, summaries, and associated metadata.

See Also

md_run(), md_replicate(), md_check(), md_plot()


Create a movedesign_preprocess object for preprocessed results

Description

Creates an S3 object of class movedesign_preprocess to store preprocessing steps or outputs during a movedesign workflow.

Usage

movedesign_preprocess(input)

Arguments

input

A list, containing preprocessed results and metadata.

Value

An object of class movedesign_preprocess and movedesign.

See Also

md_run()


Table of movement processes.

Description

Lists all continuous-time movement process models in ctmm. Each row is a different movement model applicable for animal movement.

Usage

movmods

Format

A data.frame with 5 rows and 6 variables:

name

Full descriptive name of the model (e.g., "Ind. Ident. Distr. (IID)"). Used throughout ctmm. See reference for more details on each model and their properties.

name_short

Abbreviated name, used where space is limited.

tau_p

Logical. TRUE if the model includes the position autocorrelation timescale (i.e., home range crossing time).

tau_v

Logical. TRUE if the model includes the velocity autocorrelation timescale (i.e., directional persistence).

hrange

Logical; TRUE if the model supports range residency, meaning the animal is likely to remain within a bounded area or "home range" instead of expanding indefinitely.

pars

Character string summarizing which autocorrelation parameters (e.g., tau_p, tau_v) the model estimates. Shown in HTML for documentation.

...

References


Construct a movedesign S3 object

Description

A generic internal constructor for creating S3 objects representing different stages of a "movedesign" workflow, such as input, preprocessing, simulation, output, diagnostics, and plots.

Usage

new_movedesign(x, subclass, ...)

Arguments

x

The underlying data or object to be wrapped (e.g., list, tibble, simulation object, output).

subclass

Character string specifying the subclass (e.g., movedesign_input, movedesign_output).

...

Additional attributes to set on the object.

Value

An object of class subclass and movedesign.


Print method for movedesign_check objects

Description

Print method for movedesign_check objects

Usage

## S3 method for class 'movedesign_check'
print(x, ...)

Arguments

x

An object of class movedesign_check

...

Unused


Print method for movedesign_input

Description

Print method for movedesign_input

Usage

## S3 method for class 'movedesign_input'
print(x, ...)

Arguments

x

An object of class movedesign_input

...

Additional arguments


Print method for movedesign_output

Description

Print method for movedesign_output

Usage

## S3 method for class 'movedesign_output'
print(x, ...)

Arguments

x

An object of class movedesign_output

...

Additional arguments


Print method for movedesign_preprocess

Description

Print method for movedesign_preprocess

Usage

## S3 method for class 'movedesign_preprocess'
print(x, ...)

Arguments

x

An object of class movedesign_preprocess

...

Additional arguments


Print method for movedesign_report objects

Description

Print method for movedesign_report objects

Usage

## S3 method for class 'movedesign_report'
print(x, ...)

Arguments

x

An object of class movedesign_report

...

Unused


Run movedesign R Shiny application

Description

Run movedesign R Shiny application

Usage

run_app(
  onStart = NULL,
  options = list(),
  enableBookmarking = NULL,
  uiPattern = "/",
  ...
)

Arguments

onStart

A function called before the app runs. Only relevant for programmatic usage.

options

A named list passed to shiny::runApp.

enableBookmarking

One of url, server, or disable. The default, NULL, respects any previous call to enableBookmarking.

uiPattern

A regular expression used to match request paths. The request path must match the expression in full to be handled by the UI.

...

arguments to pass to golem_opts. See ?golem::get_golem_options for more details.

Value

No return value. This function is called for its side effects.


Running hierarchical models

Description

Performs hierarchical meta-analyses on animal movement simulation outputs to estimate key movement metrics, such as mean home range area and/or mean movement speed for a sampled population. The function can also compare these metrics between two groups (via ratios) if specified.

The function leverages core methods from the ctmm package:

Optionally, the function performs resampling by randomly drawing multiple sets of individuals from the population, allowing assessment of estimate variability as sample size increases or as individuals are resampled. This approach helps quantify the precision and reliability of estimates under different sampling scenarios.

Internally, this function wraps run_meta_resamples() to fit hierarchical models without resampling for initial evaluation.

Usage

run_meta(
  rv,
  set_target = c("hr", "ctsd"),
  subpop = FALSE,
  trace = FALSE,
  iter_step = 2,
  ...
)

Arguments

rv

A named list containing simulation inputs, settings, and group assignments. Must not be NULL.

set_target

Character vector specifying the target metrics. Options are "hr" (for home range area) and/or "ctsd" (for movement speed). Defaults to c("hr", "ctsd").

subpop

Logical; if TRUE, analyzes population-level inferences by subpopulations/groups (e.g., males vs. females). Requires group assigments in rv.

trace

Logical; if TRUE, prints progress messages. Default is FALSE.

iter_step

Integer. Step size used to increment the number of individuals sampled in each iteration. For example, if iter_step = 2, the function will evaluate sample sizes of 2, 4, 6, etc., up to the maximum population sample size. Defaults to 2.

...

Additional arguments for advanced control:

.only_max_m

Logical. If TRUE, runs the meta-analysis only at the maximum population sample size. Skips all intermediate sample sizes.

.max_m

Integer. Sets a user-defined maximum sample size to use in the resampling sequence. Overrides the default, which uses all available individuals.

.m

Integer. Specifies exact sample size to use. Overrides automatic sequence generation. Accepts a single value.

.automate_seq

Logical. If TRUE, automatically generates an informative and non-redundant sequence of sample sizes for better plot readability and runtime efficiency.

.lists

List (Optional). Supplies precomputed input objects, generated via .build_meta_objects().

Value

A data frame summarizing all outputs for each target, population sample size, and group (if specified) for a single draw (sample). Columns include:

type

Research target, e.g., hr and/or ctsd.

m

Number of individuals in the sample.

sample

Sample index (for repeated draws).

truth

True, expected value.

est

Point estimate.

lci

Lower confidence interval.

uci

Upper confidence interval.

error

Relative error.

error_lci

Lower CI for relative error.

error_uci

Upper CI for relative error.

ratio_truth

True group ratio (A/B), if subpop=TRUE.

ratio_est

Estimated group ratio.

ratio_lci

Lower CI for estimated group ratio.

ratio_uci

Upper CI for estimated group ratio.

overlaps

Logical; whether estimate overlaps with the truth.

is_grouped

Logical; TRUE if grouped.

group

Group label (All, A, B).

subpop_detected

Logical; was a subpopulation detected?

Note

This function is intended for internal use and may assume inputs follow specific structure and constraints not referenced explicitly.

See Also

run_meta_resamples(), ctmm::akde(), ctmm::speed()


Running LOOCV on hierarchical model outputs

Description

Performs Leave-One-Out Cross-Validation (LOOCV) on hierarchical model outputs to assess the influence of individual simulated animals on population-level estimates. Supports analyses with or without groups.

In each iteration, the function removes one individual, refits the hierarchical model to the remaining dataset, and recalculates the target population-level estimates. This process is repeated until every individual has been excluded once.

This approach provides insight into how sensitive overall conclusions are to specific individuals. This helps identify influential individuals and assess robustness.

Usage

run_meta_loocv(
  rv,
  set_target = c("hr", "ctsd"),
  subpop = FALSE,
  trace = FALSE,
  ...
)

Arguments

rv

A reactiveValues object or list containing simulation inputs, fitted models, and (optionally) group assignments.

set_target

Character vector specifying the target metrics. Options are "hr" for home range area and/or "ctsd" for movement speed. Defaults to c("hr", "ctsd").

subpop

Logical; if TRUE, analyzes population-level inferences by groups (e.g., males vs. females). Requires valid group assigments in rv.

trace

Logical; if TRUE, prints progress and diagnostic messages. Default is FALSE.

...

Additional arguments for advanced control:

.only_max_m

Logical. If TRUE, runs the meta-analysis only at the maximum population sample size, skipping all intermediate sample sizes.

.progress

Integer. Displays a progress bar.

.m

Integer. Specifies exact sample size to use. Overrides automatic sequence generation. Accepts a single value.

.lists

List (optional); supplies precomputed input objects, typically created via .build_meta_objects().

Value

A data frame containing summarized simulation outputs.

Author(s)

Inês Silva i.simoes-silva@hzdr.de

Examples

if(interactive()) {
   run_meta_loocv(rv, set_target = "hr")
}


Running hierarchical models (with resampling)

Description

This function performs meta-analyses on simulated animal tracking data, to estimate key movement metrics, such as mean home range area and/or mean movement speed for a sampled population. The function can also compare these metrics between two groups if specified.

When resampling is enabled, the function repeatedly draws random subsets of individuals from the available population to simulate how parameter estimates behave across varying population sample sizes. This resampling allows users to assess estimate variability as sample size increases or as individuals are resampled. For example, it can reveal if the mean home range area converges as more individuals are added to the sampled population.

This approach helps quantify the robustness and precision of estimated parameters under different sampling scenarios.

The function leverages core methods from the ctmm package:

Usage

run_meta_resamples(
  rv,
  set_target = c("hr", "ctsd"),
  subpop = FALSE,
  random = FALSE,
  max_draws = 100,
  iter_step = 2,
  trace = FALSE,
  ...
)

Arguments

rv

A named list containing simulation inputs, settings, and group assignments. Must not be NULL.

set_target

Character vector specifying the target metrics. Options are "hr" (for home range area) and/or "ctsd" (for movement speed). Defaults to c("hr", "ctsd").

subpop

Logical; if TRUE, analyzes population-level inferences by subpopulations/groups (e.g., males vs. females). Requires group assigments in rv.

random

Logical; if TRUE, performs random sampling of individuals using different combinations (up to max_draws).

max_draws

Integer; maximum number of random draws per combination size when random=TRUE. Ignored if random=FALSE.

iter_step

Integer. Step size used to increment the number of individuals sampled in each iteration. For example, if iter_step = 2, the function will evaluate sample sizes of 2, 4, 6, etc., up to the maximum population sample size. Defaults to 2.

trace

Logical; if TRUE, prints progress messages. Default is FALSE.

...

Additional arguments for advanced control:

.only_max_m

Logical. If TRUE, runs the meta-analysis only at the maximum population sample size. Skips all intermediate sample sizes.

.max_m

Integer. Sets a user-defined maximum sample size to use in the resampling sequence. Overrides the default, which uses all available individuals.

.m

Integer. Specifies exact sample size to use. Overrides automatic sequence generation. Accepts a single value.

.automate_seq

Logical. If TRUE, automatically generates an informative and non-redundant sequence of sample sizes for better plot readability and runtime efficiency.

.lists

List (Optional). Supplies precomputed input objects, generated via .build_meta_objects().

Value

A data frame summarizing all outputs for each target, population sample size, sample, and group (if specified). Columns include:

type

Research target, e.g., "hr" or "ctsd".

m

Number of individuals in the sample.

sample

Sample index (for repeated draws).

truth

True value.

est

Point estimate.

lci

Lower confidence interval.

uci

Upper confidence interval.

error

Relative error.

error_lci

Lower CI for relative error.

error_uci

Upper CI for relative error.

ratio_truth

True group ratio (A/B), if subpop=TRUE.

ratio_est

Estimated group ratio.

ratio_lci

Lower CI for estimated group ratio.

ratio_uci

Upper CI for estimated group ratio.

overlaps

Logical; whether estimate overlaps with the truth.

is_grouped

Logical; TRUE if grouped.

group

Group label ("All", "A", "B").

subpop_detected

Logical; was a subpopulation detected?

Author(s)

Inês Silva i.simoes-silva@hzdr.de

See Also

akde, speed,

Examples

if(interactive()) {
   run_meta_resamples(rv, set_target = "hr")
}


Simulate movement data from continuous-time movement models

Description

Generates simulated animal movement tracks based on continuous-time movement models using ctmm::simulate(). Supports both single-group and grouped simulations, as determined by study design and data parameters. Used within the movedesign application workflows to create synthetic data for simulation studies and to evaluate study design.

Usage

simulating_data(rv, seed)

Arguments

rv

A reactiveValues object with all simulation inputs:

  • dur A list with elements value and unit (e.g., list(value = 2, unit = "months")), for the study's maximum duration. unit must be either "second", "minute", "hour", "day", "month", or "year".

  • dti A list with elements value and unit (e.g., list(value = 1, unit = "day")), specifying the intended sampling interval between relocations. unit must be either "second", "minute", "hour", "day", "month", or "year".

  • data_type: Character, data source that informs the simulations.

  • add_ind_var: Logical; if TRUE, draws parameters from population distribution for each new individual.

  • modList: List of fitted models.

  • meanfitList: List of mean models for individual variation.

  • grouped: Logical; if TRUE, simulates from two groups.

  • which_meta: Character vector; analytical target.

  • tau_p, tau_v, sigma, mu: Lists of movement parameters.

seed

Integer for random number generator, ensuring reproducibility.

Details

This function simulates animal movement tracks based on the selected mode and design settings. It first constructs a time sequence using the specified duration and interval. Depending on the simulation mode (data_type), it either retrieves movement models from modList (for simulated data) or uses meanfitList or raw movement parameters to build models (for uploaded or selected data). If a group comparison is requested, models are prepared for both groups. Tracks are then simulated using ctmm::simulate() and subsequently pseudonymized.

Value

A list of simulated movement datasets:

Note

This function is intended for internal use and may assume inputs follow specific structure and constraints not referenced explicitly.


Summary method for movedesign_check objects

Description

Summary method for movedesign_check objects

Usage

## S3 method for class 'movedesign_check'
summary(object, ...)

Arguments

object

An object of class movedesign_check

...

Unused


Summary method for movedesign_input

Description

Summary method for movedesign_input

Usage

## S3 method for class 'movedesign_input'
summary(object, ...)

Arguments

object

An object of class movedesign_input

...

Additional arguments


Summary method for movedesign_output

Description

Summary method for movedesign_output

Usage

## S3 method for class 'movedesign_output'
summary(object, ...)

Arguments

object

An object of class movedesign_output

...

Additional arguments


Summary method for movedesign_preprocess

Description

Summary method for movedesign_preprocess

Usage

## S3 method for class 'movedesign_preprocess'
summary(object, ...)

Arguments

object

An object of class movedesign_preprocess

...

Additional arguments


Summary method for movedesign_report objects

Description

Summary method for movedesign_report objects

Usage

## S3 method for class 'movedesign_report'
summary(object, ...)

Arguments

object

An object of class movedesign_report

...

Unused

mirror server hosted at Truenetwork, Russian Federation.