simDSM {AHMbook} | R Documentation |
Simulate line transect data for density surface modeling
Description
The function generates a population represented as a binomial point pattern in a heterogeneous landscape with density a function of the covariate Habitat. Data for multiple line transect surveys using a wiggly transect are then simulated, and the pixel IDs for the activity centers of detected individuals returned.
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
simDSM(X, Ntotal = 400, sigma = 0.65, beta1 = 1.0,
nsurveys = 2, xlim = c(-0.5, 3.5), ylim = c(-0.5, 4.5), show.plots = TRUE)
Arguments
X |
a 2-column matrix with coordinates of regularly spaced points along the transect line; see Examples. |
Ntotal |
the true total number of individuals in the study area. |
sigma |
scale parameter for the half-normal detection function. |
beta1 |
coefficient for the relationship between the Habitat covariate and population density. |
nsurveys |
the number of replicate surveys along the transect. |
xlim , ylim |
the extent of the (rectangular) study area |
show.plots |
if TRUE, summary plots are displayed. |
Value
A list with the values of the input arguments and the following additional elements:
Habitat |
a vector for the habitat covariate for each pixel |
Habgrid |
a 2-column matrix with the coordinates of center of each pixel |
nPix |
the number of pixels in the study area |
N |
true number of activity centers in each pixel |
U |
a 2-column matrix with the locations of ACs for all individuals in the population |
Ucap |
a 2-column matrix with the locations of ACs for individuals detected at least once |
nind |
the number of individuals detected at least once |
pixel |
a nind x nsurvey matrix with the pixel ID for the activity center or NA if the individual was not detected on the survey |
Author(s)
Marc Kéry, Andy Royle & Mike Meredith
References
Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 11.10.
Examples
# Run the function with default values and look at the output
library(AHMbook)
data(wigglyLine)
points <- sp::SpatialPoints( wigglyLine )
sLine <- sp::Line(points)
regpoints <- sp::spsample(sLine, 100, type = "regular")
str(simDSM(X = regpoints@coords))
# Generate the data set used in AHM2 11.10
RNGversion("3.5.3")
set.seed(2027, kind = "Mersenne-Twister")
tmp <- simDSM(X = regpoints@coords) # Produces Fig 11.15 in the book