sim3Occ: Simulate detection/nondetection data for static 3-level...

Description Usage Arguments Value Author(s) References Examples

View source: R/sim3Occ_AHM1_10-10_Simulate_static_3level_occupancy.R

Description

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.

Usage

1
2
3
4
5
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)

Arguments

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.

Value

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 nsubunits

p.time.effect

Simulated time effect on p, a vector of length nreps

p

Detection probabiliy, a nunits x nsubunits x nreps array

z

Occupancy indicator for main units, a nunits x 1 array of 0/1

a

Occupancy indicator for subunits, a nunits x nsubunits array of 0/1

y

Detection array, a nunits x nsubunits x nreps array of 0/1

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 nunits

covB

Simulated covariate B, a nunits x nsubunits matrix

covC

Simulated covariate C, a nunits x nsubunits x nreps array

Author(s)

Marc Kéry & Andy Royle

References

Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 10.10.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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))

AHMbook documentation built on Oct. 26, 2020, 9:07 a.m.