Learn R Programming

MultiNMix (version 0.1.0)

simulateData: Simulate Data for Multi-Species N-Mixture Models

Description

Simulates multi-species correlated abundance data for various Multi-Species N-Mixture (MNM) model types, including standard MNM, Hurdle, AR (autoregressive), and HurdleAR models.

Usage

simulateData(
  model = "MNM",
  R = 10,
  S = 2,
  T = 5,
  prob = "all",
  abundance = "small",
  K = 4,
  theta = 0.5
)

Value

A list containing:

  • Y: Array of observed abundances.

  • N: Array of true abundances.

  • p: Array of detection probabilities.

  • Sigma: Covariance matrix for the multivariate normal variable a.

  • mu: Mean vector for the multivariate normal variable a.

  • lambda: Latent abundance rate parameter.

  • correlation: Correlation matrix derived from Sigma.

  • R, T, S, K: Number of sites, sampling occasions, species, and time points.

  • Additional elements depending on the model type:

    • phi: Autoregression parameter (AR and HurdleAR models).

    • muPhi: Mean of the autoregressive parameter (AR and HurdleAR models).

    • varPhi: Variance of the autoregressive parameter (AR and HurdleAR models).

    • zeros: Matrix of zero-indicators for hurdle models.

    • theta: Zero-inflation parameter for hurdle models.

Arguments

model

Character. Specifies the model type. Options are "MNM", "Hurdle", "AR", "HurdleAR". Default is "MNM".

R

Integer. Number of sites. Default is 10.

S

Integer. Number of species. Default is 2.

T

Integer. Number of replicates. Default is 5.

prob

Character. Specifies the range of detection probabilities:

  • "small": Detection probabilities < 0.4.

  • "large": Detection probabilities > 0.5.

  • "all": Detection probabilities between 0.01 and 0.99 (default).

abundance

Character. Specifies the abundance size:

  • "small": Latent species abundance between 0 and 50.

  • "large": Latent species abundance between 0 and 700. Default is "small".

K

Integer. Number of time points (used for AR models). Default is 4.

theta

Numeric. Probability of zero-inflation (used for hurdle models). Default is 0.5.

Details

This function generates abundance data for multi-species N-mixture models under different configurations:

  • MNM: Standard multi-species N-mixture model.

  • Hurdle: Includes a hurdle component to model zero-inflated data.

  • AR: Includes an autoregressive (AR) component for temporal dependencies.

  • HurdleAR: Combines hurdle and AR components for zero-inflation and temporal dependencies. The output includes observed and true abundances, detection probabilities, latent variables, and covariance information for the random effects.

See Also

  • simulateData_MNM: Helper function for simulating standard MNM data.

  • simulateData_Hurdle: Helper function for simulating hurdle MNM data.

  • simulateData_AR: Helper function for simulating AR MNM data.

  • simulateData_Hurdle_AR: Helper function for simulating hurdle AR MNM data.

Examples

Run this code
# Simulate data for a standard MNM model
data <- simulateData(model = "MNM", R = 10, S = 3, T = 5, prob = "all",
abundance = "small")

# Simulate data for a hurdle model
data <- simulateData(model = "Hurdle", R = 10, S = 3, T = 5, prob = "large",
abundance = "large", theta = 0.3)

# Simulate data for an autoregressive model
data <- simulateData(model = "AR", R = 10, S = 2, T = 5, K = 4, prob = "small",
abundance = "small")

# Simulate data for a hurdle autoregressive model
data <- simulateData(model = "HurdleAR", R = 10, S = 3, T = 5, K = 4, prob = "all",
abundance = "large", theta = 0.5)

Run the code above in your browser using DataLab