simAbund {spAbundance} | R Documentation |
Simulate Univariate Data for Testing GLMMs
Description
The function simAbund
simulates univariate data without imperfect detection for simulation studies, power assessments, or function testing related to GLMMs. Data can be optionally simulated with a spatial Gaussian Process in the model. Non-spatial random effects can also be included in the model.
Usage
simAbund(J.x, J.y, n.rep, n.rep.max, beta, kappa, tau.sq, mu.RE = list(),
offset = 1, sp = FALSE, svc.cols = 1, cov.model, sigma.sq, phi, nu,
family = 'Poisson', z, x.positive = FALSE, ...)
Arguments
J.x |
a single numeric value indicating the number of sites to simulate count 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 count data along the vertical axis. Total number of sites with simulated data is |
n.rep |
a numeric vector of length |
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 abundance model. |
kappa |
a single numeric value containing the dispersion parameter for the abundance portion of the model. Only relevant when |
tau.sq |
a single numeric value containing the residual variance parameter of the Gaussian distribution. Only relevant when |
mu.RE |
a list used to specify the non-spatial random intercepts included in the model. The list must have two tags: |
sp |
a logical value indicating whether to simulate a spatially-explicit model with a Gaussian process. By default set to |
offset |
either a single numeric value, a vector of length |
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 abundance data. 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 |
family |
the distribution to use for the data. Currently
supports |
z |
a vector of length |
x.positive |
a logical value indicating whether the simulated covariates should be simulated as random standard normal covariates ( |
... |
currently no additional arguments |
Value
A list comprised of:
X |
a three-dimensional numeric design array of covariates with dimensions corresponding to sites, replicates, and number of covariates (including an intercept) for the model. |
coords |
a |
w |
a matrix of the spatial random effects. Only used to simulate data when |
mu |
a |
y |
a |
X.re |
a numeric three-dimensional array containing the levels of any abundance random effect included in the model. Only relevant when abundance random effects are specified in |
beta.star |
a numeric vector that contains the simulated abundance random effects for each given level of the random effects included in the abundance model. Only relevant when abundance random effects are included in the model. |
Author(s)
Jeffrey W. Doser doserjef@msu.edu
Examples
set.seed(401)
J.x <- 15
J.y <- 15
J <- J.x * J.y
n.rep <- sample(3, J, replace = TRUE)
beta <- c(0, -1.5, 0.3, -0.8)
p.abund <- length(beta)
mu.RE <- list(levels = c(30), sigma.sq.mu = c(1.3))
kappa <- 0.5
sp <- FALSE
family <- 'NB'
dat <- simAbund(J.x = J.x, J.y = J.y, n.rep = n.rep, beta = beta,
kappa = kappa, mu.RE = mu.RE, sp = sp, family = 'NB')