simNpC: Generate counts from a single population observed over T years under a binomial observation process
Description
Generates counts from a single population observed over T years and which can be observed with or without imperfect detection. The goal is to focus on what happens with relative-abundance inference when temporal patterns in abundance are confounded with temporal patterns in detection probability. Hence, we can simulate a stable population or one with linear increase or decrease with specified start and end points, and around which there is Poisson noise. The observed counts are Binomial outcomes with a detection probability which can similarly be chosen to be constant or change linearly over time.
Usage
simNpC(T = 20, expN = c(100, 75), dp = c(0.5, 0.5), show.plot = TRUE)
Value
A list with the values of the arguments entered and the following additional elements:
- lambda
T vector, expected abundance for each year.
- p
T vector, detection probability (dp) for each year.
- N
T vector, realized abundance.
- C
T vector, observed counts.
Arguments
- T
The length of the time series.
- expN
The expected abundance at start and end of period, linear trend.
- dp
The detection probability at start and end of period, linear trend.
- show.plot
Choose whether to show plots or not. Set to FALSE when using function in simulations.
Author
Marc Kéry & Andy Royle
References
Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 1.2.
Examples
Run this code# Run with the default arguments and look at the structure of the output:
set.seed(123)
tmp <- simNpC()
str(tmp)
tmp$C
Run the code above in your browser using DataLab