sample.sad: Sample from an SAD object

View source: R/sampleSAD.R

sample.sadR Documentation

Sample from an SAD object

Description

Samples a desired number of individuals from an sad object.

Usage

sample.sad(x, size, replace = FALSE, prob = NULL)

Arguments

x

an object of class sad

size

the number of individuals to sample from the SAD

replace

logical, should sampling be done with replacement or without

prob

an optional numeric specifying probability of inclusion in a sample, either a single scalar value or vector of length equal to length of x, see Details.

Details

If a single scalar values is supplied for prob, size will be calculated as size = prob*sum(x); if a vector of length equal to length of x is giving this will not change the value of size but rather indicate the relative probabilities of each species appearing in the sample (e.g. for simulating species-specific detection bias)

Value

A numeric vector of variable length depending on how many species have sampled abundance > 0

Author(s)

Andy Rominger <ajrominger@gmail.com>

See Also

sample

Examples

x <- rtpois(1000, 2)
sad1 <- fitSAD(x, models='tpois')
sample(sad1[[1]], 10)


ajrominger/pika documentation built on Nov. 13, 2022, 8:22 a.m.