sim_occ: Simulate data from the single species, single season site...

Description Usage Arguments Details Value Examples

View source: R/occ_functions.R

Description

This function simulates data from the single species, single season occupancy model first developed by MacKenzie et al. (2002).

Usage

1
2
3
4
5
6
7
8
sim_occ(
  M = 20,
  max_j = 10,
  beta_psi = c(0, 1),
  beta_p = c(0, 1),
  seed = NULL,
  rand_visits = TRUE
)

Arguments

M

number of sites

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_p

vector of regression coefficients used to generate p

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 vanilla single season, single species occupancy model using the logit link function. 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_p can be set to intercepts that generate the desired derived probabilities.

Value

object of class list containing the following elements:

Examples

1
2
sim <- sim_occ(M = 100, max_j = 20, beta_psi = c(0, 1), beta_p = c(0, 1, 1), rand_visits = TRUE)
sim$Y

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