Description Usage Arguments Details Value Author(s) References See Also Examples
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
), Two-Innate Rates Model (with fitTirm
) or the Two-Innate Rates Model with partitioned data (with fitTirmPartition
)
1 | simCapture(n, s, dist.func, return.cap.probs=FALSE)
|
n |
The number of individuals in the population |
s |
The 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 ( |
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 distributions
such as a uniform (drawCapRatesUnif
), exponential (drawCapRatesExp
), gamma (drawCapRatesGamma
) and geometric (drawCapRatesGeom
).
If return.cap.probs=FALSE
: A two-column data frame 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
: A list consisting of two items 1) A three-column data frame with the first column specifiying the individual IDs, the second column specifying the number of times each individual was captured
and the third denoting the capture probability associated with each individual and
2) A two-column data frame 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.
Matthew W. Pennell
Pennell M.W., C.R. Stansbury, L.P. Waits and C.R. Miller. submitted. capwire: A R Package for Estimating Population Census Size from Non-Invasive Genetic Sampling
drawCapRatesUnif
, drawCapRatesGeom
, drawCapRatesExp
, drawCapRatesBeta
, drawCapRatesGamma
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ## Specify that capture probabilities are drawn from a uniform distribution
rates <- drawCapRatesUnif(lower=0.1, upper=1)
## Simulate data using the specified distribution
data <- simCapture(n=20, s=100, dist.func=rates, return.cap.probs=FALSE)
data
## Example of sampling capture probabilities from a non-standard distribution
## We want to use a truncated normal for this purpose
## Create a function which takes argumens mean, sd, and trunc.point
drawCapRates.truncnorm <- function(mean, sd, trunc.point){
## Draw a large number of samples from a normal distribution with specified mean and sd
normal.dist <- rnorm(100000, mean, sd)
## Truncate the distribution at the point specified by trunc.point
trunc.dist <- normal.dist[which(normal.dist >= trunc.point)]
## Create a function which draws n samples from trunc.dist
function(n){
sample(trunc.dist, size=n, replace=TRUE)
}
}
## Specify the distribution
my.dist <- drawCapRates.truncnorm(mean=2, sd=1, trunc.point=0)
## Look at the function that is returned
my.dist
## Simulate data under the specified distribution
my.data <- simCapture(n=20, s=100, dist.func=my.dist, return.cap.probs=TRUE)
my.data
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.