This simulates line transect distance sampling data with a spatial distribution of objects in a heterogeneous landscape where the parameter beta controls the effect of habitat. Habitat is simulated according to a Gaussian random field model defined within the function. Uses a half normal detection model (if perp = TRUE) or a Gaussian hazard model (perp = FALSE).
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.
simSpatialDSline(N=1000, beta = 1, sigma=0.25, alpha0 = -2, W=1/2, L = 4,
perp=FALSE, show.plots=TRUE)
A list with the values of the input arguments and the following additional elements:
the distance between pixel centers (spatial resolution of the raster
2-column matrix with x/y coordinates of all pixels
value of habitat covariate for each pixel
a Raster object with the habitat covariate
x and y coordinates for all the animals in the population
2-column matrix of trap locations
If perp = TRUE
we have
a 2-column matrix with x and y coordinates of each animal captured.
pixel ID for each animal captured.
and if perp = FALSE
we have
a matrix with rows for each animal captured and columns for trap of first capture, distance from trap to animal, and x and y coordinates of the animal.
probability that each animal is the population is captured at least once
pixel ID for each animal captured.
total population size in the rectangle
coefficient of spatial covariate x for the density model.
scale of half-normal detection function
intercept of the hazard function.
half-width of the rectangle, which extends W each side of the transect line.
length of the transect.
if TRUE, data are simulated for a traditional distance sampling model with perpendicular distances; if FALSE (the default) a model with 'forward distance' data, ie, the distance from the observer to the animal on first detection.
if TRUE, summary plots are displayed.
Marc Kéry & Andy Royle
Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 11.
# Run the function with default values and look at the output
str(tmp <- simSpatialDSline(), 1) # use str(., max.level=1) to limit the amount of output.
Run the code above in your browser using DataLab