Learn R Programming

AHMbook (version 0.2.10)

wigglyOcc: Simulate static occupancy data

Description

Function to generate a static occupancy data set with really wiggly covariate relationships in occupancy and detection probability.

To recreate the data sets used in the book with R 3.6.0 or later, include sample.kind="Rounding" in the call to set.seed. This should only be used for reproduction of old results.

Usage

wigglyOcc(seed = 1, show.plot = TRUE, verbose = TRUE)

Value

A list with the following elements:

M

Number of sites

J

Number of replicate surveys

Xsite

Simulated site covariate, a vector of length M

Xsurvey

Simulated survey covariate, a M x J matrix

psi

Occupancy probability, a vector of length M

z

Realized occupancy, a 0/1 vector of length M

p

Detection probability, a M x J matrix

y

detection history, a M x J matrix of 0/1

Arguments

seed

Seed for random number generator

show.plot

choose whether to show plots or not. Set to FALSE when using function in simulations.

verbose

if TRUE, output will be written to the console.

Author

Marc Kéry & Andy Royle

References

Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 10.14.

Examples

Run this code
# Generate data with the default arguments and look at the structure:
tmp <- wigglyOcc()
str(tmp)

Run the code above in your browser using DataLab