distributions {coenocliner}R Documentation

Wrappers to random number generators for use with coenocliner

Description

These functions are simple wrappers around existing random number generators in R to provide stochastic count data for simulated species.

Usage

NegBin(n, mu, alpha)

Poisson(n, mu)

Bernoulli(n, mu)

Binomial(n, mu, size)

BetaBinomial(n, mu, size, theta)

ZIP(n, mu, zprobs)

ZINB(n, mu, alpha, zprobs)

ZIB(n, mu, size, zprobs)

ZIBB(n, mu, size, theta, zprobs)

Arguments

n

the number of random draws, equal to number of species times the number of gradient locations.

mu

the mean or expectation of the distribution. For Bernoulli, Binomial, and BetaBinomial() this is the probability of occurrence as given by the response function.

alpha

numeric; dispersion parameter for the negative binomial distribution. May be a vector of length length(mu). The NB2 parametrization of the negative binomial is used here, in which \alpha is positively related to the amount of extra dispersion in the simulated data. As such, where \alpha = 0, we would have a Poisson distribution. alpha can be supplied a value of 0, in which case NegBin and ZINB return random draws from the Poisson or zero-inflated Poisson distributions, respectively. Negative values of alpha are not allowed and will generate an error.

size

numeric; binomial denominator, the total number of individuals counted for example

theta

numeric; a positive inverse overdispersion parameter for the Beta-Binomial distribution. Low values give high overdispersion. The variance is size*mu*(1-mu)*(1+(size-1)/(theta+1)) (Bolker, 2008)

zprobs

numeric; zero-inflation parameter giving the proportion of extraneous zeros. Must be in range 0 \dots 1.

Value

a vector of random draws from the stated distribution.

Author(s)

Gavin L. Simpson

References

Bolker, B.M. (2008) Ecological Models and Data in R. Princeton University Press.


[Package coenocliner version 0.2-3 Index]