Function to simulate detection/nondetection data under a variant of the demographic occupancy (or 'local survival') model of Roth & Amrhein (2010). Data are simulated in an 'unconditional' manner, i.e., for each site from first to last year. All parameters can be made year-dependent by specification of a range within which annual values will be drawn from uniform distributions.
simDemoDynocc(nsites = 100, nyears = 10, nvisits = 5, psi1 = 0.6,
range.phi = c(0.2, 0.9), range.r = c(0, 0.4), range.p = c(0.1, 0.9),
show.plot=TRUE)
Number of sites.
Number of years (or 'seasons', as they are somewhat confusingly often called in the occupancy literature).
Number of replicate surveys (= occasions) within a year.
occupancy probability in first year.
bounds of uniform distribution from which annual local probability of persistence is randomly drawn.
bounds of uniform distribution from which annual local probability of colonization is randomly drawn.
bounds of uniform distribution from which annual probability of detection is randomly drawn.
If TRUE, plots of results are displayed; set to FALSE if running simulations.
A list with the values of the arguments input and the following additional elements:
persistence for each interval, a vector of length nyears - 1
colonization for each interval, a vector of length nyears - 1
detection probability for each year, a vector of length nyears
true occurrence state, a nsites x nyears matrix of 0/1
the observed detection history, a nsites x nvisits x nyears array
year of first detection, a vector of length nsites
the true number of occupied sites, a vector of length nyears
the observed number of occupied sites, a vector of length nyears
Roth, T. & Amrhein, V. (2010), Estimating individual survival using territory occupancy data on unmarked animals. Journal of Applied Ecology, 47, 386-392.
K<U+00E9>ry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 4.
# NOT RUN {
# Generate data with the default arguments and look at the structure:
str(data <- simDemoDynocc() ) # Implicit defaults
str(data <- simDemoDynocc(psi1 = 1)) # All sites initially occupied
str(data <- simDemoDynocc(nsites = 1000)) # Plenty more sites
str(data <- simDemoDynocc(nyears = 100)) # Plenty more years
str(data <- simDemoDynocc(nvisits = 20)) # Plenty more visits
str(data <- simDemoDynocc(range.phi = c(0.8, 0.8))) # Constant survival
str(data <- simDemoDynocc(range.phi = c(0.2,0.3), range.r = c(0,0.2))) # Decline
str(data <- simDemoDynocc(range.phi = c(0.8,1), range.r = c(0.5,0.7))) # Increase
str(data <- simDemoDynocc(nvisits = 1)) # Single visit
str(data <- simDemoDynocc(range.p = c(1,1))) # Perfect detection
# }
Run the code above in your browser using DataLab