rsad(S, frac, sad, Pois.samp = TRUE, k , zeroes = FALSE, ssize=1, ...)
sad
0 < frac <= 1<="" code="">; fraction of the community sampled
rlnorm
; geom for the geometric distribution
rgeom
.
Note that at the present moment only the following disS
species. The expected species abundances in the sampled community follow a
probability distribution given by the argument sad
. A fraction frac
of
the community is sampled, thus the expected abundance in the sample of each
species is frac*n
, where n is the species' expected abundance in the
community.Two sampling processes can be simulated: Poisson, where individuals are sampled independently, and negative binomial, where individuals are aggregated over sampling units.
In general terms, this function takes a Poisson or negative
binomial sampling with replacement of a vector of S
realizations of a random variable,
with the sampling intensity given by frac
. The resulting values are
realizations of a Poisson (or a Negative Binomial) random variable where the
parameter that corresponds to the mean (=expected value of the variable) follows a probability
distribution given by the argument sad
.
dpoix
, dpoig
and dpoilog
for
examples of compound Poisson probability distributions like those
simulated by rsad
.##A Poisson sample from a community with a lognormal sad
samp2 <- rsad(S = 100, frac=0.1, sad="lnorm", meanlog=5, sdlog=2)
## Preston plot
plot(octav(samp2))
## Once this is a Poisson sample of a lognormal community, the abundances
## in the sample should follow a Poisson-lognormal distribution.
## Adds line of theoretical Poisson-lognormal with
## mu=meanlog+log(frac) and sigma=sdlog)
## Predicted by the theoretical Poisson-lognormal truncated at zero
samp2.pred <- octavpred(samp2, sad="poilog", coef= list(mu=5+log(0.1), sig=2), trunc=0)
## Adding the line in the Preston plot
lines(samp2.pred)
Run the code above in your browser using DataLab