dmzsm | R Documentation |
Density, distribution, quantile function and random generation
for Alonso & McKane's mZSM distribution with parameter theta
.
dmzsm(x, J, theta, log = FALSE)
pmzsm(q, J, theta, lower.tail=TRUE, log.p=FALSE)
qmzsm(p, J, theta, lower.tail = TRUE, log.p = FALSE)
rmzsm(n, J, theta)
x |
vector of (non-negative integer) quantiles. In the context of species abundance distributions, this is a vector of abundance of species in a sample. |
q |
vector of (non-negative integer) quantiles. In the context of species abundance distributions, a vector of abundance of species in a sample. |
n |
number of random values to return. |
p |
vector of probabilities. |
J |
positive integer 0 < J < Inf, sample size. In the context of species abundance distributions, usually the number of individuals in a sample. |
theta |
positive real theta > 0; Hubbell's ‘fundamental biodiversity number’ |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
The metacommunity Zero-sum multinomial distribution (mZSM) describes the probabilities of abundances (population sizes) in a random sample of size J taken from a collection of populations (the metacommunity). The total number of individuals in the metacommunity is fixed (zero-sum assumption). The populations in the metacommunity undergo a stochastic birth-death-immigration process, with equal demographic rates (neutrality or ecological equivalence assumption, Hubbell 2001). Alonso and McKane (2004) proposed an approximation for the density function for a large Poisson sample (J>100):
p(x) = \frac{N(x)}{\sum_1^S N(x)}
where S is the number of populations in the sample, and N(x) is the expected number of sampled populations of size x :
N(x) = \frac{\theta}{x (1 - x/J)^{\theta -1}}
Therefore, the mZSM is a model for species abundances distributions (SAD) in a sample taken from a community under the assumptions that (a) species abundances in the community follows the stationary distribution of a neutral, zero-sum stochastic process of birth, death and speciation (or migration); (b) sampling is a Poisson process with expected value well approximated by N(x), (c) individuals are sampled with replacement, or the fraction of total individuals sampled is small enough to approximate a sample with replacement.
dmzsm
gives the (log) density function, pmzsm
gives the (log)
distribution function, and qmzsm
gives the quantile function.
Invalid values for parameters J
or theta
will result in return
values NaN
, with a warning.
Paulo I Prado prado@ib.usp.br, Murilo Dantas Miranda and Andre Chalom
Alonso, D. and McKane, A.J. 2004. Sampling Hubbell's neutral model of biodiversity. Ecology Letters 7:901-910.
Hubbell, S.P. 2001. The Unified Neutral Theory of Biodiversity. Princeton University Press.
fitmzsm
for maximum likelihood estimation;
alonso.eqn12
in package untb which is based on the exact formulation of mZSM.
## Alonso & McKanne (2004) figure 2
data(moths) #Fisher's moths data
m.tab <- hist(moths, breaks = 2^(0:12), plot = FALSE)
plot(m.tab$density~m.tab$mids, log="xy",
xlab = "Abundance", ylab = "Probability density",
ylim=c(1e-7,1))
X <- 1:max(moths)
Y <- dmzsm(X, J = sum(moths), theta = 39.8)
lines(Y ~ X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.