simData.fn: Simulate count data under a binomial N-mixture model

data.fnR Documentation

Simulate count data under a binomial N-mixture model

Description

Function to simulate point counts replicated at M sites during J occasions. Population closure is assumed for each site. Expected abundance may be affected by elevation (elev), forest cover (forest) and their interaction. Expected detection probability may be affected by elevation, wind speed (wind) and their interaction. Used in AHM1 to illustrate how a data set under some specific model of interest can be simulated.

Usage

data.fn(M = 267, J = 3, mean.lambda = 2, beta1 = -2, beta2 = 2, beta3 = 1,
   mean.detection = 0.3, alpha1 = 1, alpha2 = -3, alpha3 = 0, show.plot = TRUE)

Arguments

M

Number of spatial replicates (sites)

J

Number of temporal replicates (occasions)

mean.lambda

Mean abundance at value 0 of abundance covariates

beta1

Main effect of elevation on abundance

beta2

Main effect of forest cover on abundance

beta3

Interaction effect on abundance of elevation and forest cover

mean.detection

Mean detection prob. at value 0 of detection covariates

alpha1

Main effect of elevation on detection probability

alpha2

Main effect of wind speed on detection probability

alpha3

Interaction effect on detection of elevation and wind speed

show.plot

if TRUE, plots of the data will be displayed; set to FALSE if you are running simulations

Value

A list with the input arguments and the following additional elements:

elev

Scaled elevation (a vector of length M)

forest

Scaled forest cover (a vector of length M)

wind

Scaled wind speed (an M x J matrix)

lambda

Expected number of individuals at each site (a vector of length M)

N

Realized number of individuals at each site (a vector of length M)

p

Probability of detection for each survey (an M x J matrix)

C

The number of detections for each survey (an M x J matrix)

Ntotal

Total abundance, sum(N)

psi.true

True occupancy in sample

summaxC

Sum of max counts (all sites)

psi.obs

Observed occupancy in sample

Note

The colors used for points in some of the plots indicate different temporal replicates.

Author(s)

Marc Kéry & Andy Royle

References

Kéry, M. & Royle, J.A. (2016) Applied Hierarchical Modeling in Ecology AHM1 - 4.3.

Examples

# Generate a simulated data set with default arguments and look at the structure:
tmp <- data.fn()
str(tmp)

str(data.fn(J = 2))              # Only 2 surveys
str(data.fn(J = 1))              # No temporal replicate
str(data.fn(M = 1, J = 100))     # No spatial replicates, but 100 counts
str(data.fn(beta3 = 1))          # With interaction elev-wind on p
str(data.fn(M = 267, J = 3, mean.lambda = 2, beta1 = -2, beta2 = 2, beta3 = 1,
  mean.detection = 1))           # No obs. process (i.e., p = 1, perfect detection)
str(data.fn(mean.lambda = 50))   # Really common species
str(data.fn(mean.lambda = 0.05)) # Really rare species

AHMbook documentation built on Aug. 24, 2023, 1:07 a.m.