Skip to contents

This function generates simulated location data using movement models. The function supports both single and grouped simulations based on whether the data is simulated or derived from an emulated or fitted model.

Usage

simulating_data(rv)

Arguments

rv

A reactive values list containing:

  • dur - A list specifying the sampling duration (value and unit).

  • dti - A list specifying the time interval between locations (value and unit).

  • data_type - A character string indicating data type.

  • is_emulate - Logical; if TRUE, the function generates an emulated model.

  • modList - A list of fitted movement models for simulation.

  • meanfitList - A list of a mean model for emulation.

  • grouped - Logical; if TRUE, the simulation considers grouped movement models.

  • which_meta - A character vector indicating whether to compare models.

  • tau_p, tau_v, sigma, mu - Lists of movement model parameters.

  • seed0 - An integer used for random seed initialization.

Value

A list containing one or two simulated movement datasets (depending on grouping):

  • If grouped = FALSE, returns a list with a single simulated dataset.

  • If grouped = TRUE, returns a list with two simulated datasets (for groups A and B).

Details

The function first constructs a time sequence based on the provided duration and interval. If the data is fully simulated from scratch (not conditioned on existing data), it retrieves movement model(s) from rv$modList. Otherwise, it either emulates a model using rv$meanfitList and a random seed or constructs a model from movement parameters.

If estimate comparisons are enabled (via which_meta), two models are prepared. The function then runs ctmm::simulate() to generate simulated movement data. The resulting trajectories are pseudonymized before returning.