simCapture: simCapture

View source: R/simulate-capwire.R

simCaptureR Documentation

simCapture

Description

Simulates capture count data where individual capture rates are assumed to be drawn from a specified distribution.

Data can be used as input for fitting Equal Capture Model (with fitEcm) or Two Innate Rates Model (with fitTirm)

Usage

simCapture(n, s, dist.func, return.cap.probs = FALSE)

Arguments

n

number of individuals in the population

s

total number of samples collected

dist.func

The distribution of capture rates within the population (see details)

return.cap.probs

Logical, signifying whether individual capture probabilities should be returned

Details

We assume that there is heterogeneity in the capturabilities of individuals within a population. That is, some individuals are more likely to be captured than others

We also assume that the individual capturabilities are drawn from some distribution.

The distribution is specified by the dist.func argument. dist.func takes a function with parameter n, where n specifies the number of samples to be drawn.simCapture can take any distribution of this form but the capwire package includes several functions which allow for users to draw capture rates from several standard distribution such as a uniform (drawCapRatesUnif), exponential (drawCapRatesExp), gamma (drawCapRatesGamma), geometric (drawCapRatesGeom), and beta (drawCapRatesBeta).

Value

If return.cap.probs=FALSE: A two-column matrix with the first column specifiying the capture class (i.e. individuals caught i times) and the second column specifying the number of individuals in each class.

If return.cap.probs=TRUE, an additional matrix is returned with the capture probabilites of every individual in the population

#'

Author(s)

Matthew W. Pennell

References

Miller C. R., P. Joyce and L.P. Waits. 2005. A new method for estimating the size of small populations from genetic mark-recapture data. Molecular Ecology 14:1991-2005. Pennell, M. W., C. R. Stansbury, L. P. Waits and C. R. Miller. Capwrie: a R package for estimating population census size from non-invasive genetic sampling

See Also

simTirm, simEcm

Examples

## Specify a uniform distribution
ud <- drawCapRatesUnif(0,1)
simCapture(n=20, s=100, ud)

## Specify an exponential distribution
ed <- drawCapRatesExp(0.5)
simCapture(n=20, s=100, ed)

## Specify a gamma distribution
gd <- drawCapRatesGamma(1,0.5)
simCapture(n=20, s=100, gd)

## Specify a geometric distribution
md <- drawCapRatesGeom(0.5)
simCapture(n=20, s=100, md)

## Specify a beta distribution
bd <- drawCapRatesBeta(1, 0.5)
simCapture(n=20, s=100, bd)

## Specify a custom distribution
## Here a one-tailed normal distribution
drawCapRatesAbsNorm <- function(mean, sd){function(n){abs(rnorm(n, mean, sd))}}
nd <- drawCapRatesAbsNorm(0,1)
simCapture(n=20, s=100, nd)

mwpennell/capwire documentation built on Jan. 12, 2023, 11:19 a.m.