simHDStr {AHMbook} R Documentation

## Simulate HDS time-removal or double-observer data

### Description

A general function for simulating hierarchical distance sampling (HDS) data combined with a time-removal (with 3 removal periods) or double-observer protocol, either for a line or a point transect protocol and with method = "removal" or method = "double". Also produces plots of the output.

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 log-linear regression with arguments beta0 and beta1 to calculate the expected number of groups in each strip or circle. Group size is simulated by first drawing from a Poisson distribution with parameter lambda.group then adding 1.

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.

The group size is used in a log-linear regression with arguments alpha0 and alpha1 to calculate the scale parameter, sigma, of the half-normal detection function. Detections are simulated according to the selected protocol.

To recreate the data sets used in the book with R 3.6.0 or later, include sample.kind="Rounding" in the call to set.seed. This should only be used for reproduction of old results.

### Usage

simHDStr(type = c("line", "point"), method=c("removal", "double"), nsites = 200,
lambda.group = 1, alpha0 = 0, alpha1 = 0, beta0 = 1, beta1 = 0.5,
p.avail = 0.75, K = 3, p.double = c(0.4, 0.6),
B = 3, discard0 = FALSE, show.plot = TRUE)


### Arguments

 type The type of distance transect, either "line" or "point". method Is the method time-removal ("removal") or double-observer ("double")? nsites Number of sites (spatial replication) lambda.group Poisson mean of group size alpha0 intercept of log-linear model relating sigma of half-normal detection function to group size alpha1 slope of log-linear model relating sigma of half-normal detection function to group size beta0 intercept of log-linear model relating the Poisson mean of the number of groups per unit area to habitat beta1 slope of log-linear model relating the Poisson mean of the number of groups per unit area to habitat p.avail overall availability probability (phi in text) K number of removal periods (of equal length) p.double detection probability for first and second observer B strip half width or radius of the circle discard0 whether to discard or keep the data from sites with nobody detected show.plot choose whether to show plots or not. Set to FALSE when running simulations.

### Value

A list with the values of the arguments and the following additional elements:

 data simulated distance sampling data: a matrix with a row for each group detected and 7 columns: site ID, status (1 if captured), x and y coordinates (NA for line transects), distance from the line or point, group size, the time interval of removal or capture history; if discard0 = FALSE, sites with no detections will appear in the matrix with NAs in columns 2 to 7. habitat simulated habitat covariate M simulated number of groups at each site M.true for point counts, the simulated number of groups within the circle sampled params a vector with the input arguments

### Author(s)

Marc Kéry & Andy Royle

### References

Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 9.3.2 (time removal) and 9.4.1 (double observer).

### Examples

# Run with the default arguments and look at the structure of the output:
set.seed(123)
tmp <- simHDStr() # default: line, removal
str(tmp)
head(tmp$data) tmp <- simHDStr("point", method="double") str(tmp) head(tmp$data)


[Package AHMbook version 0.2.9 Index]