simTOcc {spOccupancy} | R Documentation |
Simulate Multi-Season Single-Species Detection-Nondetection Data
Description
The function simTOcc
simulates multi-season single-species occurrence data for simulation studies, power assessments, or function testing. Data can be optionally simulated with a spatial Gaussian Process in the occurrence portion of the model. Non-spatial random intercepts can also be included in the detection or occurrence portions of the occupancy model.
Usage
simTOcc(J.x, J.y, n.time, n.rep, n.rep.max, beta, alpha, sp.only = 0, trend = TRUE,
psi.RE = list(), p.RE = list(), sp = FALSE, svc.cols = 1, cov.model,
sigma.sq, phi, nu, ar1 = FALSE, rho, sigma.sq.t, x.positive = FALSE,
mis.spec.type = 'none', scale.param = 1, avail, grid, ...)
Arguments
J.x |
a single numeric value indicating the number of sites to simulate detection-nondetection data along the horizontal axis. Total number of sites with simulated data is |
J.y |
a single numeric value indicating the number of sites to simulate detection-nondetection data along the vertical axis. Total number of sites with simulated data is |
n.time |
a single numeric value indicating the number of primary time periods (denoted T) over which sampling occurs. |
n.rep |
a numeric matrix indicating the number of replicates at each site during each primary time period. The matrix must have |
n.rep.max |
a single numeric value indicating the maximum number of replicate surveys. This is an optional argument, with its default value set to |
beta |
a numeric vector containing the intercept and regression coefficient parameters for the occupancy portion of the single-species occupancy model. Note that if |
alpha |
a numeric vector containing the intercept and regression coefficient parameters for the detection portion of the single-species occupancy model. |
sp.only |
a numeric vector specifying which occurrence covariates should only vary over space and not over time. The numbers in the vector correspond to the elements in the vector of regression coefficients ( |
trend |
a logical value. If |
psi.RE |
a list used to specify the unstructured random intercepts included in the occupancy portion of the model. The list must have two tags: |
p.RE |
a list used to specify the unstructured random intercepts included in the detection portion of the model. The list must have two tags: |
sp |
a logical value indicating whether to simulate a spatially-explicit occupancy model with a Gaussian process. By default set to |
svc.cols |
a vector indicating the variables whose effects will be
estimated as spatially-varying coefficients. |
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 decay parameter. Ignored when |
nu |
a numeric value indicating the spatial smoothness parameter. Only used when |
ar1 |
a logical value indicating whether to simulate a temporal random effect with an AR(1) process. By default, set to |
rho |
a numeric value indicating the AR(1) temporal correlation parameter. Ignored when |
sigma.sq.t |
a numeric value indicating the AR(1) temporal variance parameter. Ignored when |
x.positive |
a logical value indicating whether the simulated covariates should be simulated as random standard normal covariates ( |
mis.spec.type |
a quoted keyword indicating the type of model mis-specification to use when simulating the data. These correspond to model mis-specification of the functional relationship between occupancy/detection probability and covariates. Valid keywords are: |
scale.param |
a positive number between 0 and 1 that indicates the scale parameter for the occupancy portion of the model when |
avail |
a site x primary time period x visit array indicating the availability probability of the species during each survey simulated at the given site/primary time period/visit combination. This can be used to assess impacts of non-constant availability across replicate surveys in simulation studies. Values should fall between 0 and 1. When not specified, availability is set to 1 for all surveys. |
grid |
an atomic vector used to specify the grid across which to simulate the latent spatial processes. This argument is used to simulate the underlying spatial processes at a different resolution than the coordinates (e.g., if coordinates are distributed across a grid). |
... |
currently no additional arguments |
Value
A list comprised of:
X |
a |
X.p |
a four-dimensional numeric array with dimensions corresponding to sites, primary time periods, repeat visits, and number of detection regression coefficients. This is the design matrix used for the detection portion of the occupancy model. |
coords |
a |
w |
a |
psi |
a |
z |
a |
p |
a |
y |
a |
X.p.re |
a four-dimensional numeric array containing the levels of any detection random effect included in the model. Only relevant when detection random effects are specified in |
X.re |
a numeric matrix containing the levels of any occurrence random effect included in the model. Only relevant when occurrence random effects are specified in |
alpha.star |
a numeric vector that contains the simulated detection random effects for each given level of the random effects included in the detection model. Only relevant when detection random effects are included in the model. |
beta.star |
a numeric vector that contains the simulated occurrence random effects for each given level of the random effects included in the occurrence model. Only relevant when occurrence random effects are included in the model. |
eta |
a |
Author(s)
Jeffrey W. Doser doserjef@msu.edu,
References
Stoudt, S., P. de Valpine, and W. Fithian. Non-parametric identifiability in species distribution and abundance models: why it matters and how to diagnose a lack of fit using simulation. Journal of Statistical Theory and Practice 17, 39 (2023). https://doi.org/10.1007/s42519-023-00336-5.
Examples
J.x <- 10
J.y <- 10
J <- J.x * J.y
# Number of time periods sampled
n.time <- sample(10, J, replace = TRUE)
n.time.max <- max(n.time)
# Replicates
n.rep <- matrix(NA, J, max(n.time))
for (j in 1:J) {
n.rep[j, 1:n.time[j]] <- sample(1:4, n.time[j], replace = TRUE)
}
# Occurrence --------------------------
# Fixed
beta <- c(0.4, 0.5, -0.9)
trend <- TRUE
sp.only <- 0
psi.RE <- list(levels = c(10),
sigma.sq.psi = c(1))
# Detection ---------------------------
alpha <- c(-1, 0.7, -0.5)
p.RE <- list(levels = c(10),
sigma.sq.p = c(0.5))
# Spatial parameters ------------------
sp <- TRUE
cov.model <- "exponential"
sigma.sq <- 2
phi <- 3 / .4
nu <- 1
# Temporal parameters -----------------
ar1 <- TRUE
rho <- 0.5
sigma.sq.t <- 0.8
# Get all the data
dat <- simTOcc(J.x = J.x, J.y = J.y, n.time = n.time, n.rep = n.rep,
beta = beta, alpha = alpha, sp.only = sp.only, trend = trend,
psi.RE = psi.RE, p.RE = p.RE,
sp = sp, cov.model = cov.model, sigma.sq = sigma.sq, phi = phi,
ar1 = ar1, rho = rho, sigma.sq.t = sigma.sq.t)
str(dat)