# Richness and Rarefaction

Source:`R/AllGenerics.R`

, `R/index_rarefaction.R`

, `R/index_richness.R`

`richness-index.Rd`

`index_richness()`

returns sample richness.`index_composition()`

returns asymptotic species richness.`rarefaction()`

returns Hurlbert's unbiased estimate of Sander's rarefaction.`bootstrap_*()`

and`jackknife_*()`

perform bootstrap/jackknife resampling.

## Usage

```
index_richness(object, ...)
simulate_richness(object, ...)
bootstrap_richness(object, ...)
jackknife_richness(object, ...)
index_composition(object, ...)
rarefaction(object, ...)
# S4 method for CountMatrix
rarefaction(object, sample, method = c("hurlbert"), simplify = TRUE, ...)
# S4 method for CountMatrix
index_richness(object, method = c("none", "margalef", "menhinick"), ...)
# S4 method for CountMatrix
simulate_richness(
object,
method = c("none", "margalef", "menhinick"),
quantiles = TRUE,
level = 0.8,
step = 1,
n = 1000,
progress = getOption("tabula.progress"),
...
)
# S4 method for CountMatrix
bootstrap_richness(
object,
method = c("none", "margalef", "menhinick"),
probs = c(0.05, 0.95),
n = 1000,
...
)
# S4 method for CountMatrix
jackknife_richness(object, method = c("none", "margalef", "menhinick"), ...)
# S4 method for CountMatrix
index_composition(
object,
method = c("chao1", "ace"),
unbiased = FALSE,
improved = FALSE,
k = 10
)
# S4 method for IncidenceMatrix
index_composition(
object,
method = c("chao2", "ice"),
unbiased = FALSE,
improved = FALSE,
k = 10
)
```

## Arguments

- object
A \(m \times p\) matrix of count data.

- ...
Further arguments to be passed to internal methods.

- sample
A length-one

`numeric`

vector giving the sub-sample size.- method
A

`character`

string or vector of strings specifying the index to be computed (see details). Any unambiguous substring can be given.- simplify
A

`logical`

scalar: should the result be simplified to a matrix? The default value,`FALSE`

, returns a list.- quantiles
A

`logical`

scalar: should sample quantiles be used as confidence interval? If`TRUE`

(the default), sample quantiles are used as described in Kintigh (1989), else quantiles of the normal distribution are used.- level
A length-one

`numeric`

vector giving the confidence level.- step
A non-negative

`integer`

giving the increment of the sample size. Only used if`simulate`

is`TRUE`

.- n
A non-negative

`integer`

giving the number of bootstrap replications.- progress
A

`logical`

scalar: should a progress bar be displayed?- probs
A

`numeric`

vector of probabilities with values in \([0,1]\) (see`stats::quantile()`

).- unbiased
A

`logical`

scalar. Should the bias-corrected estimator be used? Only used with "`chao1`

" or "`chao2`

" (improved) estimator.- improved
A

`logical`

scalar. Should the improved estimator be used? Only used with "`chao1`

" or "`chao2`

".- k
A length-one

`numeric`

vector giving the threshold between rare/infrequent and abundant/frequent species. Only used if`method`

is "`ace`

" or "`ice`

".

## Value

`index_richness()`

,`simulate_richness()`

and`index_composition()`

return a`DiversityIndex`

object.`bootstrap_*()`

and`jackknife_*()`

return a`data.frame`

.

If `simplify`

is `FALSE`

, then `rarefaction()`

returns a `list`

(default),
else return a `matrix`

.

## Details

The number of different taxa, provides an instantly comprehensible
expression of diversity. While the number of taxa within a sample
is easy to ascertain, as a term, it makes little sense: some taxa
may not have been seen, or there may not be a fixed number of taxa
(e.g. in an open system; Peet 1974). As an alternative, *richness*
(\(S\)) can be used for the concept of taxa number (McIntosh 1967).

It is not always possible to ensure that all sample sizes are equal
and the number of different taxa increases with sample size and
sampling effort (Magurran 1988). Then, *rarefaction* (\(E(S)\)) is
the number of taxa expected if all samples were of a standard size (i.e.
taxa per fixed number of individuals). Rarefaction assumes that imbalances
between taxa are due to sampling and not to differences in actual
abundances.

The following richness measures are available for count data:

`margalef`

Margalef richness index.

`menhinick`

Menhinick richness index.

`none`

Returns the number of observed taxa/types.

## Asymptotic Species Richness

The following measures are available for count data:

`ace`

Abundance-based Coverage Estimator.

`chao1`

(improved/unbiased) Chao1 estimator.

The following measures are available for replicated incidence data:

`ice`

Incidence-based Coverage Estimator.

`chao2`

(improved/unbiased) Chao2 estimator.

## References

Chao, A. (1984). Nonparametric Estimation of the Number of Classes in a
Population. *Scandinavian Journal of Statistics*, 11(4), 265-270.

Chao, A. (1987). Estimating the Population Size for Capture-Recapture Data
with Unequal Catchability. *Biometrics* 43(4), 783-791.
doi: 10.2307/2531532
.

Chao, A. & Chiu, C.-H. (2016). Species Richness: Estimation and Comparison.
*In* Balakrishnan, N., Colton, T., Everitt, B., Piegorsch, B., Ruggeri,
F. & Teugels, J. L. (Eds.), *Wiley StatsRef: Statistics Reference Online*.
Chichester, UK: John Wiley & Sons, Ltd., 1-26.
doi: 10.1002/9781118445112.stat03432.pub2

Chao, A. & Lee, S.-M. (1992). Estimating the Number of Classes via Sample
Coverage. *Journal of the American Statistical Association*, 87(417),
210-217. doi: 10.1080/01621459.1992.10475194
.

Chiu, C.-H., Wang, Y.-T., Walther, B. A. & Chao, A. (2014). An improved
nonparametric lower bound of species richness via a modified good-turing
frequency formula. *Biometrics*, 70(3), 671-682.
doi: 10.1111/biom.12200
.

Hurlbert, S. H. (1971). The Nonconcept of Species Diversity: A Critique and
Alternative Parameters. *Ecology*, 52(4), 577-586.
doi: 10.2307/1934145
.

Magurran, A. E. (1988). *Ecological Diversity and its Measurement*.
Princeton, NJ: Princeton University Press. doi: 10.1007/978-94-015-7358-0
.

Kintigh, K. W. (1989). Sample Size, Significance, and Measures of
Diversity. In Leonard, R. D. and Jones, G. T., *Quantifying Diversity
in Archaeology*. New Directions in Archaeology. Cambridge:
Cambridge University Press, p. 25-36.

Magurran, A E. & Brian J. McGill (2011). *Biological Diversity:
Frontiers in Measurement and Assessment*. Oxford: Oxford University Press.

Margalef, R. (1958). Information Theory in Ecology. *General Systems*,
3, 36-71.

Menhinick, E. F. (1964). A Comparison of Some Species-Individuals Diversity
Indices Applied to Samples of Field Insects. *Ecology*, 45(4), 859-861.
doi: 10.2307/1934933
.

McIntosh, R. P. (1967). An Index of Diversity and the Relation of Certain
Concepts to Diversity. *Ecology*, 48(3), 392-404.
doi: 10.2307/1932674
.

Sander, H. L. (1968). Marine Benthic Diversity: A Comparative Study.
*The American Naturalist*, 102(925), 243-282.

## See also

Other diversity:
`heterogeneity-index`

,
`similarity()`

,
`turnover-index`

## Examples

```
## Richness
## Margalef and Menhinick index
## Data from Magurran 1988, p. 128-129
trap <- CountMatrix(data = c(9, 3, 0, 4, 2, 1, 1, 0, 1, 0, 1, 1,
1, 0, 1, 0, 0, 0, 1, 2, 0, 5, 3, 0),
nrow = 2, byrow = TRUE, dimnames = list(c("A", "B"), NULL))
index_richness(trap, method = "margalef") # 2.55 1.88
#> <RichnessIndex: margalef>
#> size index
#> A 23 2.551432
#> B 13 1.949356
index_richness(trap, method = "menhinick") # 1.95 1.66
#> <RichnessIndex: menhinick>
#> size index
#> A 23 1.876630
#> B 13 1.664101
## Asymptotic species richness
## Chao1-type estimators
## Data from Chao & Chiu 2016
brazil <- CountMatrix(
data = rep(x = c(1:21, 23, 25, 27, 28, 30, 32, 34:37, 41,
45, 46, 49, 52, 89, 110, 123, 140),
times = c(113, 50, 39, 29, 15, 11, 13, 5, 6, 6, 3, 4,
3, 5, 2, 5, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1,
0, 0, 2, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0)),
nrow = 1, byrow = TRUE
)
index_composition(brazil, method = c("chao1"), unbiased = FALSE) # 461.625
#> <CompositionIndex: chao1>
#> size index
#> row1 1978 461.6254
index_composition(brazil, method = c("ace"), k = 10) # 445.822
#> <CompositionIndex: ace>
#> size index
#> row1 1978 445.8224
## Rarefaction
rarefaction(trap, sample = 13) # 6.56
#> A B
#> 6.556735 NA
```