View source: R/sim3Occ_AHM1_10-10_Simulate_static_3level_occupancy.R
sim3Occ | R Documentation |
Function generates 3-level occupancy data with possibility of site-specific random variation at every level, "time effects" at the middle and the lower levels and effects of one distinct covariate at each level.
sim3Occ(nunits = 100, nsubunits = 5, nreps = 3,
mean.psi = 0.8, beta.Xpsi = 1, sd.logit.psi = 0,
mean.theta = 0.6, theta.time.range = c(-1, 1), beta.Xtheta = 1, sd.logit.theta = 0,
mean.p = 0.4, p.time.range = c(-2, 2), beta.Xp = -1, sd.logit.p = 0,
show.plot = TRUE, verbose = TRUE)
nunits |
Number of main units (large quadrats) |
nsubunits |
Number of subunits (nested subsamples within each main unit) |
nreps |
Number of replicate surveys in every subunit |
mean.psi |
Mean large-scale, unit-level occupancy probability (psi) |
beta.Xpsi |
effect on psi of covariate A (at main unit level) |
sd.logit.psi |
SD of logit(psi), unstructured site variation in psi |
mean.theta |
Mean small-scale (subunit) occupancy probability (theta) |
theta.time.range |
range of theta 'intercepts' for subunits |
beta.Xtheta |
effect on theta of covariate B (at subunit level) |
sd.logit.theta |
SD of logit(theta), unstructured site variation in theta |
mean.p |
Mean per-survey detection probability |
p.time.range |
range of p 'intercepts' for replicates |
beta.Xp |
effect on p of covariate C (unit by subunit by replicate) |
sd.logit.p |
SD of logit(p) |
show.plot |
choose whether to show plots or not. Set to FALSE when using function in simulations. |
verbose |
if TRUE, output will be written to the console. |
A list with the values of the input arguments and the following additional elements:
theta.time.effect |
Simulated time effect on theta, a vector of length |
p.time.effect |
Simulated time effect on p, a vector of length |
p |
Detection probabiliy, a |
z |
Occupancy indicator for main units, a |
a |
Occupancy indicator for subunits, a |
y |
Detection array, a |
sum.z |
True number of occupied main units |
obs.sum.z |
Observed number of occupied main units |
sum.z.a |
Number of units with >=1 occupied, surveyed subunit |
covA |
Simulated covariate A, a vector of length |
covB |
Simulated covariate B, a |
covC |
Simulated covariate C, a |
Marc Kéry & Andy Royle
Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 10.10.
# Generate data with the default arguments and look at the structure:
tmp <- sim3Occ()
str(tmp)
# 'Null' model (model 1)
str(data <- sim3Occ(nunits = 100, nsubunits = 5, nreps = 3, mean.psi = 0.8,
beta.Xpsi = 0, sd.logit.psi = 0, mean.theta = 0.6, theta.time.range = c(0, 0),
beta.Xtheta = 0, sd.logit.theta = 0, mean.p = 0.4, p.time.range = c(0,0),
beta.Xp = 0, sd.logit.p = 0))
# No covariate effects, no random variability (model 2)
str(data <- sim3Occ(nunits = 100, nsubunits = 5, nreps = 3, mean.psi = 0.8,
beta.Xpsi = 0, sd.logit.psi = 0, mean.theta = 0.6, theta.time.range = c(-1, 1),
beta.Xtheta = 0, sd.logit.theta = 0, mean.p = 0.4, p.time.range = c(-2,2),
beta.Xp = 0, sd.logit.p = 0))
# All covariate effects, but no random variability (model 3)
str(data <- sim3Occ(nunits = 100, nsubunits = 5, nreps = 3, mean.psi = 0.8,
beta.Xpsi = 1, sd.logit.psi = 0, mean.theta = 0.6, theta.time.range = c(-1, 1),
beta.Xtheta = 1, sd.logit.theta = 0, mean.p = 0.4, p.time.range = c(-2,2),
beta.Xp = -1, sd.logit.p = 0))
# Most complex model with all effects allowed for by sim function (model 4)
str(data <- sim3Occ(nunits = 100, nsubunits = 5, nreps = 3, mean.psi = 0.8,
beta.Xpsi = 1, sd.logit.psi = 1, mean.theta = 0.6, theta.time.range = c(-1, 1),
beta.Xtheta = 1, sd.logit.theta = 1, mean.p = 0.4, p.time.range = c(-2,2),
beta.Xp = -1, sd.logit.p = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.