simIntOcc {spOccupancy} | R Documentation |
Simulate Single-Species Detection-Nondetection Data from Multiple Data Sources
Description
The function simIntOcc
simulates single-species detection-nondetection data from multiple data sources for simulation studies, power assessments, or function testing of integrated occupancy models. Data can optionally be simulated with a spatial Gaussian Process on the occurrence process.
Usage
simIntOcc(n.data, J.x, J.y, J.obs, n.rep, n.rep.max, beta, alpha,
sp = FALSE, cov.model, sigma.sq, phi, nu, ...)
Arguments
n.data |
an integer indicating the number of detection-nondetection data sources to simulate. |
J.x |
a single numeric value indicating the number of sites across the region of interest along the horizontal axis. Total number of sites across the simulated region of interest is |
J.y |
a single numeric value indicating the number of sites across the region of interest along the vertical axis. Total number of sites across the simulated region of interest is |
J.obs |
a numeric vector of length |
n.rep |
a list of length |
n.rep.max |
a vector of numeric values indicating the maximum number of replicate surveys for each data set. This is an optional argument, with its default value set to |
beta |
a numeric vector containing the intercept and regression coefficient parameters for the occurrence portion of the single-species occupancy model. |
alpha |
a list of length |
sp |
a logical value indicating whether to simulate a spatially-explicit occupancy model with a Gaussian process. By default set to |
cov.model |
a quoted keyword that specifies the covariance function used to model the spatial dependence structure among the latent occurrence values. Supported covariance model key words are: |
sigma.sq |
a numeric value indicating the spatial variance parameter. Ignored when |
phi |
a numeric value indicating the spatial range parameter. Ignored when |
nu |
a numeric value indicating the spatial smoothness parameter. Only used when |
... |
currently no additional arguments |
Value
A list comprised of:
X.obs |
a numeric design matrix for the occurrence portion of the model. This matrix contains the intercept and regression coefficients for only the observed sites. |
X.pred |
a numeric design matrix for the occurrence portion of the model at sites where there are no observed data sources. |
X.p |
a list of design matrices for the detection portions of the integrated occupancy model. Each element in the list is a design matrix of detection covariates for each data source. |
coords.obs |
a numeric matrix of coordinates of each observed site. Required for spatial models. |
coords.pred |
a numeric matrix of coordinates of each site in the study region without any data sources. Only used for spatial models. |
D.obs |
a distance matrix of observed sites. Only used for spatial models. |
D.pred |
a distance matrix of sites in the study region without any observed data. Only used for spatial models. |
w.obs |
a matrix of the spatial random effects at observed locations. Only used to simulate data when |
.
w.pred |
a matrix of the spatial random random effects at locations without any observation. |
psi.obs |
a matrix of the occurrence probabilities for each observed site. |
psi.pred |
a matrix of the occurrence probabilities for sites without any observations. |
z.obs |
a vector of the latent occurrence states at each observed site. |
z.pred |
a vector of the latent occurrence states at each site without any observations. |
p |
a list of detection probability matrices for each of the |
y |
a list of matrices of the raw detection-nondetection data for each site and replicate combination. |
Author(s)
Jeffrey W. Doser doserjef@msu.edu,
Andrew O. Finley finleya@msu.edu
Examples
set.seed(400)
# Simulate Data -----------------------------------------------------------
J.x <- 15
J.y <- 15
J.all <- J.x * J.y
# Number of data sources.
n.data <- 4
# Sites for each data source.
J.obs <- sample(ceiling(0.2 * J.all):ceiling(0.5 * J.all), n.data, replace = TRUE)
# Replicates for each data source.
n.rep <- list()
for (i in 1:n.data) {
n.rep[[i]] <- sample(1:4, size = J.obs[i], replace = TRUE)
}
# Occupancy covariates
beta <- c(0.5, 1, -3)
p.occ <- length(beta)
# Detection covariates
alpha <- list()
for (i in 1:n.data) {
alpha[[i]] <- runif(sample(1:4, 1), -1, 1)
}
p.det.long <- sapply(alpha, length)
p.det <- sum(p.det.long)
sigma.sq <- 2
phi <- 3 / .5
sp <- TRUE
# Simulate occupancy data.
dat <- simIntOcc(n.data = n.data, J.x = J.x, J.y = J.y, J.obs = J.obs,
n.rep = n.rep, beta = beta, alpha = alpha, sp = TRUE,
cov.model = 'gaussian', sigma.sq = sigma.sq, phi = phi)