Learn R Programming

birp (version 0.0.5)

simulate_birp: Simulate Data for BIRP Models Generates simulated count data using the BIRP model framework with user-defined parameters.

Description

Simulate Data for BIRP Models Generates simulated count data using the BIRP model framework with user-defined parameters.

Usage

simulate_birp(
  timepoints = c(1, 2, 3),
  timesOfChange = c(),
  gamma = NULL,
  negativeBinomial = FALSE,
  stochastic = FALSE,
  numLocations = 2,
  numMethods = 1,
  numCIGroups = 1,
  numCovariatesEffort = 1,
  numCovariatesDetection = 0,
  BACI = NULL,
  n_bar = 1000,
  N_0 = NULL,
  a = NULL,
  logSigma = NULL,
  logPhi = NULL,
  covariatesEffort = "gamma(1, 2)",
  covariatesDetection = "normal(0, 1)",
  proportionZeroEffort = 0,
  verbose = TRUE
)

Value

An object of type birp_data containing the simulated dataset.

Arguments

timepoints

Integer vector specifying time points.

timesOfChange

Integer vector indicating time points at which change in growth rate (gamma) occurs.

gamma

Numeric vector denoting the values of gamma to simulate. If NULL, all gamma will be set to zero

negativeBinomial

Logical; if TRUE, use negative binomial instead of Poisson.

stochastic

Logical; if TRUE, simulate abundance as a stochastic process instead of deterministic.

numLocations

Integer; number of spatial locations.

numMethods

Integer; number of sampling methods.

numCIGroups

Integer; number of control–intervention groups.

numCovariatesEffort

Integer; number of effort covariates.

numCovariatesDetection

Integer; number of detection covariates.

BACI

Optional matrix specifying BACI design (see Details).

n_bar

Expected average total observations per time point (across all locations).

N_0

Optional numeric; initial abundance. If NULL, n_bar will be used instead

a

A numeric value or vector; detection parameter(s) for the negative binomial distribution. Can be a single value (shared across methods) or a vector of values (one per method).

logSigma

Optional numeric; log standard deviation of abundance process in the stochastic model. If NULL, logSigma will be set to -1

logPhi

Optional numeric; log standard deviation of detection process in the stochastic model. If NULL, logPhi will be simulated according to the model assumptions

covariatesEffort

Specifies how effort is calculated for covariates. Accepts: (1) a single number used for all covariates and locations; (2) a numeric vector with one value per covariate (applied to all locations); (3) a distribution string to simulate effort from, e.g., "gamma(a, b)" or "uniform(a, b)"; or (4) a vector of such distribution strings, one per covariate.

covariatesDetection

Specifies how detection probabilities are calculated for covariates. Accepts: (1) a single number for all covariates and locations; (2) a numeric vector with one value per covariate (applied to all locations); (3) a distribution string, e.g., "normal(a, b)" or "uniform(a, b)"; or (4) a vector of such distribution strings, one per covariate.

proportionZeroEffort

Proportion of time–location–method combinations with zero effort (0 to 1).

verbose

Logical; if TRUE, print progress messages.

Details

The `BACI` matrix defines a Before-After Control-Impact experimental design. It must be a binary matrix with two columns and one row per observation. - The first column indicates the time period (`0 = before`, `1 = after`). - The second column indicates the treatment type (`0 = control`, `1 = impact`). This allows modeling interactions between time and treatment to isolate impact effects.

Examples

Run this code
data <- simulate_birp()

Run the code above in your browser using DataLab