`richness()`

returns sample richness.`composition()`

returns asymptotic species richness.

## Usage

```
richness(object, ...)
composition(object, ...)
index_ace(x, ...)
index_ice(x, ...)
index_chao1(x, ...)
index_chao2(x, ...)
index_margalef(x, ...)
index_menhinick(x, ...)
# S4 method for matrix
richness(object, method = c("count", "margalef", "menhinick"))
# S4 method for data.frame
richness(object, method = c("count", "margalef", "menhinick"))
# S4 method for matrix
composition(
object,
method = c("chao1", "ace", "chao2", "ice"),
unbiased = FALSE,
improved = FALSE,
k = 10
)
# S4 method for data.frame
composition(
object,
method = c("chao1", "ace", "chao2", "ice"),
unbiased = FALSE,
improved = FALSE,
k = 10
)
# S4 method for numeric
index_margalef(x, na.rm = FALSE, ...)
# S4 method for numeric
index_menhinick(x, na.rm = FALSE, ...)
# S4 method for numeric
index_ace(x, k = 10, ...)
# S4 method for numeric
index_chao1(x, unbiased = FALSE, improved = FALSE, ...)
# S4 method for matrix
index_ice(x, k = 10, ...)
# S4 method for matrix
index_chao2(x, unbiased = FALSE, improved = FALSE, ...)
```

## Arguments

- object
A \(m \times p\)

`numeric`

`matrix`

or`data.frame`

of count data (absolute frequencies).- ...
Further arguments to be passed to internal methods.

- x
A

`numeric`

vector or matrix of count data (absolute frequencies).- method
A

`character`

string or vector of strings specifying the index to be computed (see details). Any unambiguous substring can be given.- 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`

".- na.rm
A

`numeric`

scalar: should missing values (including`NaN`

) be removed?

## Value

`richness()`

returns a RichnessIndex object.`composition()`

returns a CompositionIndex object.`index_*()`

return a`numeric`

vector.

## 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.

## Richness Measures

The following richness measures are available for count data:

`count`

Returns the number of observed taxa/types.

`margalef`

Margalef richness index.

`menhinick`

Menhinick richness index.

## 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
.

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
.

## See also

Other diversity measures:
`heterogeneity()`

,
`occurrence()`

,
`plot_diversity`

,
`rarefaction()`

,
`similarity()`

,
`simulate()`

,
`turnover()`

## Examples

```
## Data from Magurran 1988, p. 128-129
trap <- matrix(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))
## Margalef and Menhinick index
richness(trap, method = "margalef") # 2.55 1.88
#> [1] 2.551432 1.949356
richness(trap, method = "menhinick") # 1.95 1.66
#> [1] 1.876630 1.664101
## Data from Chao & Chiu 2016
brazil <- matrix(
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
)
## Chao1-type estimators (asymptotic species richness)
composition(brazil, method = c("chao1"), unbiased = FALSE) # 461.625
#> [1] 461.6254
composition(brazil, method = c("ace"), k = 10) # 445.822
#> [1] 445.8224
```