Learn R Programming

AHMbook (version 0.2.2)

simHDS: Simulate data under hierarchical distance sampling protocol (line or point)

Description

Function simulates hierarchical distance sampling (HDS) data under either a line or a point transect protocol.

Usage

simHDS(type=c("line", "point"), nsites = 100, mean.lambda = 2, beta.lam = 1,
  mean.sigma = 1, beta.sig = -0.5, B = 3, discard0 = TRUE, show.plot = TRUE)

Arguments

type

type of transect, "line" or "point".

nsites

Number of sites (spatial replication)

mean.lambda

the expected value of lambda when the habitat covariate = 0; the intercept of the log-linear regression for lambda is log(mean.lambda).

beta.lam

the slope of the log-linear regression for lambda on a habitat covariate.

mean.sigma

the expected value of the scale parameter of the half-normal detection function when the wind speed = 0; the intercept of the log-linear regression for sigma is log(mean.sigma).

beta.sig

the slope of log-linear regression of scale parameter of the half-normal detection function on wind speed

B

the strip half-width or circle radius

discard0

If TRUE, subset to sites at which individuals were captured. You may or may not want to do this depending on how the model is formulated so be careful.

show.plot

choose whether to show plots or not. Set to FALSE when using function in simulations.

Value

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

data

simulated distance sampling data: 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 discard0 = FALSE, sites with no detections will appear in the matrix with NAs in columns 2 to 5.

habitat

simulated habitat covariate

wind

simulated detection covariate

N

simulated number of individuals at each site

N.true

for point counts, the simulated number of individuals within the circle sampled

References

K<U+00E9>ry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 8.5.1.

Examples

Run this code
# NOT RUN {
# Simulate a data set with the default arguments and look at the structure of the output
set.seed(123)
tmp <- simHDS()
str(tmp)
head(tmp$data)

tmp <- simHDS("point", discard0=FALSE)
str(tmp)
head(tmp$data, 10)
# }

Run the code above in your browser using DataLab