simIntMsOcc {spOccupancy} | R Documentation |
Simulate Multi-Species Detection-Nondetection Data from Multiple Data Sources
Description
The function simIntMsOcc
simulates multi-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
simIntMsOcc(n.data, J.x, J.y, J.obs, n.rep, N, beta, alpha, psi.RE = list(),
p.RE = list(), sp = FALSE, cov.model, sigma.sq, phi, nu,
factor.model = FALSE, n.factors, ...)
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 |
a numeric vector of length |
beta |
a numeric matrix with |
alpha |
a list of length |
psi.RE |
a list used to specify the non-spatial random intercepts included in the occurrence portion of the model. The list must have two tags: |
p.RE |
this argument is not currently supported. In a later version, this argument will allow for simulating data with detection random effects in the different data sources. |
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 vector of length |
phi |
a numeric vector of length |
nu |
a numeric vector of length |
factor.model |
a logical value indicating whether to simulate data following a factor modeling approach that explicitly incoporates species correlations. If |
n.factors |
a single numeric value specifying the number of latent factors to use to simulate the data if |
... |
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 multi-species 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. |
w |
a species (or factor) x site matrix of the spatial random effects for each species. Only used to simulate data when |
w.pred |
a matrix of the spatial random random effects for each species (or factor) at locations without any observation. |
psi.obs |
a species x site matrix of the occurrence probabilities for each species at the observed sites. Note that values are provided for all species, even if some species are only monitored at a subset of these points. |
psi.pred |
a species x site matrix of the occurrence probabilities for sites without any observations. |
z.obs |
a species x site matrix of the latent occurrence states at each observed site. Note that values are provided for all species, even if some species are only monitored at a subset of these points. |
z.pred |
a species x site matrix of the latent occurrence states at each site without any observations. |
p |
a list of detection probability arrays for each of the |
y |
a list of arrays of the raw detection-nondetection data for each site and replicate combination for each species in the data set. Each array has dimensions corresponding to species, site, and replicate, respectively. |
Author(s)
Jeffrey W. Doser doserjef@msu.edu,
References
Doser, J. W., Leuenberger, W., Sillett, T. S., Hallworth, M. T. & Zipkin, E. F. (2022). Integrated community occupancy models: A framework to assess occurrence and biodiversity dynamics using multiple data sources. Methods in Ecology and Evolution, 00, 1-14. doi:10.1111/2041-210X.13811
Examples
set.seed(91)
J.x <- 10
J.y <- 10
# Total number of data sources across the study region
J.all <- J.x * J.y
# Number of data sources.
n.data <- 2
# Sites for each data source.
J.obs <- sample(ceiling(0.2 * J.all):ceiling(0.5 * J.all), n.data, replace = TRUE)
n.rep <- list()
n.rep[[1]] <- rep(3, J.obs[1])
n.rep[[2]] <- rep(4, J.obs[2])
# Number of species observed in each data source
N <- c(8, 3)
# Community-level covariate effects
# Occurrence
beta.mean <- c(0.2, 0.5)
p.occ <- length(beta.mean)
tau.sq.beta <- c(0.4, 0.3)
# Detection
# Detection covariates
alpha.mean <- list()
tau.sq.alpha <- list()
# Number of detection parameters in each data source
p.det.long <- c(4, 3)
for (i in 1:n.data) {
alpha.mean[[i]] <- runif(p.det.long[i], -1, 1)
tau.sq.alpha[[i]] <- runif(p.det.long[i], 0.1, 1)
}
# Random effects
psi.RE <- list()
p.RE <- list()
beta <- matrix(NA, nrow = max(N), ncol = p.occ)
for (i in 1:p.occ) {
beta[, i] <- rnorm(max(N), beta.mean[i], sqrt(tau.sq.beta[i]))
}
alpha <- list()
for (i in 1:n.data) {
alpha[[i]] <- matrix(NA, nrow = N[i], ncol = p.det.long[i])
for (t in 1:p.det.long[i]) {
alpha[[i]][, t] <- rnorm(N[i], alpha.mean[[i]][t], sqrt(tau.sq.alpha[[i]])[t])
}
}
sp <- FALSE
factor.model <- FALSE
# Simulate occupancy data
dat <- simIntMsOcc(n.data = n.data, J.x = J.x, J.y = J.y,
J.obs = J.obs, n.rep = n.rep, N = N, beta = beta, alpha = alpha,
psi.RE = psi.RE, p.RE = p.RE, sp = sp, factor.model = factor.model,
n.factors = n.factors)
str(dat)