sim_MSMocc: Simulate data from the multi-species, misclassification count...

Description Usage Arguments Details Value Examples

View source: R/MSMocc_functions.R

Description

This function simulates data from he multi-species, misclassification count occupancy model first developed by Wright et al. (2020).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sim_MSMocc(
  K = 2,
  M = 20,
  M.conf = 2,
  max_j = 10,
  beta_psi = matrix(c(0, 1, 0, 1.2), ncol = K),
  beta_lambda = matrix(c(0, 1, 0, 1.2), ncol = K),
  theta = matrix(c(0.8, 0.2, 0.2, 0.8), byrow = T, ncol = K),
  seed = NULL,
  rand_visits = TRUE
)

Arguments

K

number of species

M

number of sites

M.conf

number of sites that have confirmed observations

max_j

maximum number of visits to each site. If rand_visits = FALSE, this value is the number of visits to each site. If rand_visits = TRUE, each site is visited a random (sample(2:max_j, size = 1)) number of times.

beta_psi

vector of regression coefficients used to generate psi

beta_lambda

vector of regression coefficients used to generate lambda

theta

confusion matrix for automatic call classifications. Rows of theta should sum to one, diagonal elements are correct identification probabilities, first row corresponds to probabilities for calls truly from species 1.

seed

optional seed for reproducibility

rand_visits

logical; should each site be visited a random number of times? See details.

Details

This function simulates data from the single season, multiple species occupancy model to estimate occupancy and relative activity for multiple species simultaneously. If rand_visits = TRUE, each site is visited a random number of times between two and max_j. Covariates are drawn from the uniform(0, 1.5) distribution so that the effect of the direction of each regression coefficient is intuitive. Note that if covariates are not desired, beta_psi and beta_lambda can be set to intercepts that generate the desired derived probabilities.

Value

object of class list containing the following elements:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
n.species <- 4
sim <- sim_MSMocc(K = n.species, M = 100, M.conf = 10, max_j = 20,
                  beta_psi = matrix(c(0, 1,
                                      0, 1.1,
                                      0, 1.2,
                                      0, 1.3),
                                    ncol = n.species),
                  beta_lambda = matrix(c(0, 1, 1,
                                         0, 1, 1,
                                         0, 1, 1.2,
                                         0, 1, 1.4),
                                       ncol = n.species),
                  theta = matrix(c(0.7, 0.1, 0.1, 0.1,
                            0.1, 0.7, 0.1, 0.1,
                            0.1, 0.1, 0.7, 0.1,
                            0.1, 0.1, 0.1, 0.7), nrow = n.species),
                  rand_visits = TRUE)
sim$Y

StrattonCh/occupancy documentation built on Feb. 17, 2021, 6:36 a.m.