simHDSopen {AHMbook}  R Documentation 
Simulate open hierarchical distance sampling data
Description
Simulates distance sampling data for multiple replicate surveys in a multiseason (or multiyear) model, incorporating habitat and detection covariates, temporary emigration, and a trend in abundance or density.
At each site, it works with a strip of width B*2
(for line transects) or a circle of radius B
(for point transects).
The state process is simulated by first drawing a covariate value, "habitat", for each site from a Normal(0, 1) distribution. This is used in a loglinear regression with arguments mean.lam
, beta.lam
and beta.trend
to calculate the expected number of animals, lambda, in each strip or circle for each year. Site and yearspecific abundances are drawn from a Poisson distribution with mean lambda. The number available for capture at each replicate survey is simulated as a binomial distribution with probability phi
.
For line transects, the distance from the line is drawn from a Uniform(0, B) distribution. For point transects, the distance from the point is simulated from B*sqrt(Uniform(0,1)), which ensures a uniform distribution over the circle.
A detection covariate, "wind", for each survey is drawn from a Uniform(2, 2) distribution. This is used in a loglinear regression with arguments mean.sig
and beta.sig
to calculate the scale parameter, sigma, of the halfnormal detection function. Detections are simulated as Bernoulli trials with probability of success decreasing with distance from the line or point.
Usage
simHDSopen(type=c("line", "point"), nsites = 100,
mean.lam = 2, beta.lam = 0, mean.sig = 1, beta.sig = 0,
B = 3, discard0 = TRUE, nreps = 2, phi = 0.7, nyears = 5, beta.trend = 0)
Arguments
type 
the transect protocol, either "line" or "point" . 
nsites 
Number of sites (spatial replication) 
mean.lam 
intercept of loglinear regression of expected lambda on a habitat covariate 
beta.lam 
slope of loglinear regression of expected lambda on a habitat covariate 
mean.sig 
intercept of loglinear regression of scale parameter of halfnormal detection function on wind speed 
beta.sig 
slope of loglinear regression of scale parameter of halfnormal detection function on wind speed 
B 
strip half width, or maximum distance from the observer for point counts 
discard0 
Discard sites at which no individuals were captured. You may or may not want to do this depending on how the model is formulated so be careful. 
nreps 
the number of distance sampling surveys within a period of closure in a season (or year) 
phi 
the availability parameter 
nyears 
the number of seasons (typically years) 
beta.trend 
loglinear trend of annual population size or density 
Value
A list with the values of the arguments entered and the following additional elements:
data 
simulated distance sampling data: a list with a component for each year, each itself a list with a component for each replicate; this is a matrix with a row for each individual detected and 5 columns: site ID, status (1 if captured), x and y coordinates (NA for line transects), distance from the line or point; if 
habitat 
simulated habitat covariate, a vector of length 
wind 
simulated detection covariate, a 
M.true 
simulated number of individuals, a 
K 

Na 
the number of individuals available for detection, a 
Na.real 
for point counts, the number of individuals available for detection within the circle sampled, a 
Note
For "point" the realized density is [(area of circle) /(area of square)]*lambda
Author(s)
Marc Kéry & Andy Royle
References
Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1  9.5.4.1.
Examples
set.seed(123)
tmp < simHDSopen() # Generate data with default parameters
str(tmp)
head(tmp$data[[1]][[1]])
tmp < simHDSopen("point")
str(tmp)
head(tmp$data[[1]][[1]])
tmp < simHDSopen(discard0=FALSE)
str(tmp)
head(tmp$data[[1]][[1]])