Returns a vector of random draws from the Bailey estimator in a mark-recapture experiment, given values of the true abundance and the sample size in both events. The function first simulates a vector of recaptures (m2) from a binomial distribution, and then uses these to compute a vector of draws from the estimator.
If capture probabilities (p1
and/or p2
) are specified instead of sample size(s), the sample size(s) will first be drawn from a binomial distribution, then the number of recaptures. If both sample size and capture probability are specified for a given sampling event, only the sample size will be used.
rBailey(length, N, n1 = NULL, n2 = NULL, p1 = NULL, p2 = NULL)
The length of the random vector to return.
The value of the true abundance. This may be a single number or
vector of values equal to length
.
Number of individuals captured and marked in the first sample. This
may be a single number or vector of values equal to length
.
Number of individuals captured in the second sample. This may be a
single number or vector of values equal to length
.
Alternately, probability of capture in the first sample. This
may be a single number or vector of values equal to length
.
Alternately, probability of capture in the second sample. This may be a
single number or vector of values equal to length
.
A vector of random draws from the Bailey estimator
# NOT RUN {
draws <- rBailey(length=100000, N=500, n1=100, n2=100)
plotdiscdensity(draws) #plots the density of a vector of discrete values
# }
Run the code above in your browser using DataLab