Learn R Programming

AHMbook (version 0.2.2)

simHDSopen: Simulate open hierarchical distance sampling data

Description

Simulates distance sampling data from a multi-season (or multi-year) model, incorporating habitat and detection covariates, temporary emigration, and a trend in abundance or density.

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 log-linear regression of expected lambda on a habitat covariate

beta.lam

slope of log-linear regression of expected lambda on a habitat covariate

mean.sig

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

beta.sig

slope of log-linear regression of scale parameter of half-normal 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 discard0 = FALSE, sites with no detections will appear in the matrix with NAs in columns 2 to 5.

habitat

simulated habitat covariate, a vector of length nsites

wind

simulated detection covariate, a nsites x nreps x nyears array

M.true

simulated number of individuals, a nsites x nyears matrix

K

= nreps

Na

the number of individuals available for detection, a nsites x nreps x nyears array

Na.real

for point counts, the number of individuals available for detection within the circle sampled, a nsites x nreps x nyears array

References

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

Examples

Run this code
# NOT RUN {
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]])
# }

Run the code above in your browser using DataLab