diversity(x, index = "shannon", MARGIN = 1, base = exp(1))rarefy(x, sample, se = FALSE, MARGIN = 1)
fisher.alpha(x, MARGIN = 1, se = FALSE, ...)
specnumber(x, MARGIN = 1)
"shannon"
,
"simpson"
or "invsimpson"
.base
used in shannon
.nlm
se = TRUE
, function rarefy
returns a 2-row matrix
with rarefied richness (S
) and its standard error
(se
).
With option se = TRUE
, function fisher.alpha
returns a
data frame with items for $\alpha$ (alpha
), its approximate
standard errors (se
), residual degrees of freedom
(df.residual
), and the code
returned by
nlm
on the success of estimation. Both variants of Simpson's index are based on $D = \sum p_i^2$. Choice simpson
returns $1-D$ and
invsimpson
returns $1/D$.
Function rarefy
gives the expected species richness in random
subsamples of size sample
from the community. The size of
sample
should be smaller than total community size, but the
function will silently work for larger sample
as well and
return non-rarefied species richness (and standard error = 0).
Rarefaction can be performed only with genuine counts of individuals.
The function rarefy
is based on Hurlbert's (1971) formulation,
and the standard errors on Heck et al. (1975).
fisher.alpha
estimates the $\alpha$ parameter of
Fisher's logarithmic series (see fisherfit
).
The estimation is possible only for genuine
counts of individuals. The function can optionally return standard
errors of $\alpha$. These should be regarded only as rough
indicators of the accuracy: the confidence limits of $\alpha$ are
strongly non-symmetric and the standard errors cannot be used in
Normal inference.
Function specnumber
finds the number of species. With
MARGIN = 2
, it finds frequencies of species. The function is
extremely simple, and shortcuts are easy in plain R.
Better stories can be told about Simpson's index than about
Shannon's index, and still grander narratives about
rarefaction (Hurlbert 1971). However, these indices are all very
closely related (Hill 1973), and there is no reason to despise one
more than others (but if you are a graduate student, don't drag me in,
but obey your Professor's orders). In particular, the exponent of the
Shannon index is linearly related to inverse Simpson (Hill 1973)
although the former may be more sensitive to rare species. Moreover,
inverse Simpson is asymptotically equal to rarefied species richness
in sample of two individuals, and Fisher's $\alpha$ is very
similar to inverse Simpson.
Heck, K.L., van Belle, G. & Simberloff, D. (1975). Explicit calculation of the rarefaction diversity measurement and the determination of sufficient sample size. Ecology 56, 1459--1461. Hurlbert, S.H. (1971). The nonconcept of species diversity: a critique and alternative parameters. Ecology 52, 577--586.
renyi
for generalized data(BCI)
H <- diversity(BCI)
simp <- diversity(BCI, "simpson")
invsimp <- diversity(BCI, "inv")
r.2 <- rarefy(BCI, 2)
alpha <- fisher.alpha(BCI)
pairs(cbind(H, simp, invsimp, r.2, alpha), pch="+", col="blue")
## Species richness (S) and Pielou's evenness (J):
S <- specnumber(BCI) ## rowSums(BCI > 0) does the same...
J <- H/log(S)
Run the code above in your browser using DataLab