# Diversity: HCDT diversity of a community In entropart: Entropy Partitioning to Measure Diversity

## Description

Calculates the HCDT (generalized) diversity of order q of a probability vector.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```Diversity(NorP, q = 1, ...) bcDiversity(Ns, q = 1, Correction = "Best", CheckArguments = TRUE) ## S3 method for class 'ProbaVector' Diversity(NorP, q = 1, ..., CheckArguments = TRUE, Ps = NULL) ## S3 method for class 'AbdVector' Diversity(NorP, q = 1, Correction = "Best", ..., CheckArguments = TRUE, Ns = NULL) ## S3 method for class 'integer' Diversity(NorP, q = 1, Correction = "Best", ..., CheckArguments = TRUE, Ns = NULL) ## S3 method for class 'numeric' Diversity(NorP, q = 1, Correction = "Best", ..., CheckArguments = TRUE, Ps = NULL, Ns = NULL) ```

## Arguments

 `Ps` A probability vector, summing to 1. `Ns` A numeric vector containing species abundances. `NorP` A numeric vector, an integer vector, an abundance vector (`AbdVector`) or a probability vector (`ProbaVector`). Contains either abundances or probabilities. `q` A number: the order of diversity. Default is 1. `Correction` A string containing one of the possible corrections: `"None"` (no correction), `"ChaoShen"`, `"GenCov"`, `"Grassberger"`, `"Holste"`, `"Bonachela"`, `"ZhangGrabchak"`, or `"ChaoWangJost"`, `"Marcon"`, `"UnveilC"`, `"UnveiliC"`, `"UnveilJ"` or `"Best"`, the default value. Currently, `"Best"` is `"ChaoWangJost"`. `...` Additional arguments. Unused. `CheckArguments` Logical; if `TRUE`, the function arguments are verified. Should be set to `FALSE` to save time when the arguments have been checked elsewhere.

## Details

`Diversity` calls `Tsallis` to calculate entropy and transforms it into diversity by calculating its deformed exponential.

Bias correction requires the number of individuals to estimate sample `Coverage`. Use `bcDiversity` and choose the `Correction`.

The functions are designed to be used as simply as possible. `Diversity` is a generic method. If its first argument is an abundance vector, an integer vector or a numeric vector which does not sum to 1, the bias corrected function `bcDiversity` is called. Explicit calls to `bcDiversity` (with bias correction) or to `Diversity.ProbaVector` (without correction) are possible to avoid ambiguity. The `.integer` and `.numeric` methods accept `Ps` or `Ns` arguments instead of `NorP` for backward compatibility.

## Value

A named number equal to the calculated diversity. The name is that of the bias correction used.

## Author(s)

Eric Marcon <[email protected]>

## References

Marcon, E., Scotti, I., Herault, B., Rossi, V. and Lang, G. (2014). Generalization of the partitioning of Shannon diversity. PLOS One 9(3): e90289.

`Tsallis`, `expq`, `AbdVector`, `ProbaVector`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```# Load Paracou data (number of trees per species in two 1-ha plot of a tropical forest) data(Paracou618) # Ns is the total number of trees per species Ns <- as.AbdVector(Paracou618.MC\$Ns) # Species probabilities Ps <- as.ProbaVector(Paracou618.MC\$Ns) # Whittaker plot plot(Ns) # Calculate diversity of order 1, i.e. Shannon's diversity Diversity(Ps, 1) # Calculate it with estimation bias correction Diversity(Ns, 1) ```