qrao: Rao's Quadratic Entropy and Dissimilarity

qraoR Documentation

Rao's Quadratic Entropy and Dissimilarity

Description

Rao's quadratic entropy (Rao 1982) is a generalization of Simpson (or Gini-Simpson) diversity index to a situation where species are non-independent. The species dependences are expressed as dissimilarities, where 1 means independent species, and 0 a completely aliased species. Rao's distance (1982) is a similar generalization for distances between sampling units with non-independent species. Typically species distances are based on phylogenetics, taxonomy or species traits, and these measures are called phylogenetic or functional diversities and distances.

Function raostand modified data so that it is compatible to other functions, and Rao's quadratic entropy and Rao distances can be directly found from the standarized data.

Usage

qrao(x, d, na.rm = FALSE, dmax)

distrao(x, d, method = c("jensen", "euclidean", "standardized"), dmax)

raostand(x, d, propx = TRUE, dmax)

Arguments

x

Community data.

d

Phylogenetic distances or other dissimilarities among species.

na.rm

Should missing values be removed?

dmax

Scale dissimilarities by dmax (if dmax > max(d)) or truncate dissimilarities at dmax (if dmax < max(d)).

method

Distance measure to be used (see Details).

propx

Standardize row of x to unit total. This will give standardization that is compatible with qrao and distrao.

Details

Rao's quadratic entropy is H_i = \sum_{j} \sum_{k} p_{ij} p_{ik} d_{jk}, where i is the index of the sampling unit, j and k are indices of species, p is the proportion of species in the sampling unit, and d are distances among species. The distances should be scaled to range 0...1, and they are divided by the observed maximum if this exceeds 1. Alternatively, the distances are divided by argument dmax instead of data maximum. Distances that are shorter than dmax are truncated to the maximum value. The square roots of distances should be Euclidean, but this is not verified. They are Euclidean if there are no negative eigenvalues in the principal coordinates analysis, and ade4 package has function is.euclid for a canned test. If all distances are 1, species are independent and qrao will return Simpson diversity.

Function distrao finds distances based on quadratic entropy for sampling units. Rao (1982) suggested distance d_{ij} = H_{ij} - \frac{1}{2}(H_i + H_j), where H_i and H_j are Rao entropies for sites i and j and H_{ij} is the similar entropy evaluated so that the species proportions p are from different sampling units. Rao (1982) called this as Jensen distance, and it is half of the squared Euclidean distance. The Euclidean distance can also be requested. In addition, Rao (1982) suggested a standardized distance that is based on logarithms of elements H.

Function raostand standardizes data similarlty as implicitly done in qrao and raodist when propx = TRUE. For standardized data Z, quadratic entropy is found as 1 - rowSums(Z^2), and Rao distances can be found via Euclidean distances of Z. The standardized data allows calculating any generic community dissimilarity, and using Z in rda allows performing phylogenitically constrained RDA. The standardization does not preserve absences, but zero abundances will be boosted to positive values when the sampling unit has related species. More details can be found in vignette.

Value

qrao returns a vector of Rao's quadratic entropy values and distrao distances of class "dist".

References

Rao, C.R. (1982) Diversity and dissimilarity coefficients: a unified approach. Theoretical Population Biology 21, 24–43.

See Also

There are other implementations of this function in R. Most notably functions divc and disc in ade4. However, these may square input dissimilarities and divide results by 2 depending on options.

Examples

if (require(vegan)) {
data(dune, dune.phylodis)
qrao(dune, dune.phylodis)
tabasco(dune, hclust(distrao(dune, dune.phylodis)), hclust(dune.phylodis))
## regard lineages completely distinct beyond K/T (K/Pg) limit
qrao(dune, dune.phylodis, dmax = 65.2)
}

## Rao standardization
## Phylogenetic diversity
data(dune, dune.phylodis, dune.env)
Z <- raostand(dune, dune.phylodis)
all.equal(1 - rowSums(Z^2), qrao(dune, dune.phylodis),
     check.attributes = FALSE)
## Phylogenetic distance
all.equal(dist(Z), distrao(dune, dune.phylodis, method="euclidean"),
     check.attributes = FALSE)
## plot with standardized values
tabasco(Z, hclust(dist(Z)), hclust(dune.phylodis))
## phylogenetic polar ordination
pol <- polarord(vegdist(Z))
sppscores(pol) <- Z
plot(pol)
## Phylogenetically constrainted RDA
mod <- rda(raostand(dune, dune.phylodis, propx = FALSE) ~ Management + Moisture,
    dune.env)
anova(mod, by = "margin")
plot(mod, scaling = "sites")


jarioksa/natto documentation built on March 28, 2024, 12:45 a.m.