Learn R Programming

detect (version 0.3-1)

datocc: Simulated example for occupancy model

Description

Simulated example for occupancy model, see code below.

Usage

data(datocc)

Arguments

source

Simulated example.

Details

This simulated example corresponds to the ZI Binomial model implemented in the function svocc.

References

Lele, S.R., Moreno, M. and Bayne, E. (2011) Dealing with detection error in site occupancy surveys: What can we do with a single survey? Journal of Plant Ecology, 5(1), 22--31.

Examples

Run this code
data(datocc)
str(datocc)
## simulation
n <- 1000
set.seed(1234)
x1 <- runif(n, -1, 1)
x2 <- as.factor(rbinom(n, 1, 0.5))
x3 <- rnorm(n)
x4 <- rnorm(n)
beta <- c(0.6, 0.5)
theta <- c(0.4, -0.5, 0.3)
X <- model.matrix(~ x1)
Z <- model.matrix(~ x1 + x3)
mu <- drop(X %*% beta)
nu <- drop(Z %*% theta)
p.occ <- binomial("cloglog")$linkinv(mu)
p.det <- binomial("logit")$linkinv(nu)
Y <- rbinom(n, 1, p.occ)
W <- rbinom(n, 1, Y * p.det)
datocc <- data.frame(Y, W, x1, x2, x3, x4, p.occ, p.det)

Run the code above in your browser using DataLab