QE {adiv}R Documentation

Quadratic Entropy


Function QE calculates Rao's quadratic entropy within communities

Function discomQE calculates Rao's dissimilarities between communities


QE(comm, dis = NULL, formula = c("QE", "EDI"), scale = FALSE)

discomQE(comm, dis = NULL, structures = NULL, formula = c("QE", "EDI"))



a data frame or a matrix with communities as rows and species as columns. Entries are abundances of species within communities. If presences/absences (1/0) are used a given species in a community of S species will be considered to have a relative abundance of 1/S.


either NULL or an object of class dist that contains the (functional or phylogenetic) distances among species. If NULL the Gini-Simpson index is used. See details.


either "QE" (default) or "EDI". See details.


a logical value indicating whether or not the diversity coefficient should be scaled by its maximal value over all species abundance distributions.


either NULL or a data frame that contains, in the jth row and the kth column, the name of the group of level k to which the jth community belongs. Communities in structures should be in the same order as in comm.


If formula = "QE", the definition of the quadratic entropy is:

QE(p_i,D)=sum_k,l p_k|i p_k|j d_kl

where p_i=(p_1|i, ..., p_k|i, ..., p_S|i) is the vector of relative species abundance within community i; S is the number of species; D=(d_kl) is the matrix of (phylogenetic or functional) dissimilarities among species, and d_kl is the (phylogenetic or functional) dissimilarity between species k and l. For the calculations of dissimilarities between communities see the description of the apportionment of quadratic entropy in Pavoine et al. (2016) and references therein.

If formula = "EDI", the definition of the quadratic entropy is:

EDI(p_i,D)=sum_k,l p_k|i p_k|j (d_kl^2)/2

EDI stands for the Euclidean Diversity Index of Champely and Chessel (2002) (equation 3 in Pavoine et al. 2004). If EDI is used, the dissimilarities between communities calculated by discomQE are obtained as in equation 4 in Pavoine et al. (2004).

In both cases, if dis = NULL, the quadratic entropy is equal to Gini-Simpson entropy:

H_GS(p_i)=1 - sum_k (p_k|i)^2


For using function discomQE, the Euclidean properties are expected for object dis. See function is.euclid of package ade4. These properties are not necessary for using function QE. Note that discomQE can be used if dis = NULL. In that case species are considered to be equidifferent (i.e. the dissimilarity between any two species is a constant; such dissimilarities have Euclidean properties).


Function QE returns a data frame with communities as rows and the diversity within communities as columns.

If structures is NULL, function discomQE returns an object of class dist. Otherwise it returns a list of objects of class dist.


Sandrine Pavoine sandrine.pavoine@mnhn.fr


Gini, C. (1912) Variabilita e mutabilita. Universite di Cagliari III, Parte II.

Simpson, E.H. (1949) Measurement of diversity. Nature, 163, 688.

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

Champely, S. and Chessel, D. (2002) Measuring biological diversity using Euclidean metrics. Environmental and Ecological Statistics, 9, 167–177.

Pavoine, S., Dufour, A.B., Chessel, D. (2004) From dissimilarities among species to dissimilarities among communities: a double principal coordinate analysis. Journal of Theoretical Biology, 228:, 523–537.

Pavoine, S., Marcon, E., Ricotta, C. (2016) "Equivalent numbers" for species, phylogenetic, or functional diversity in a nested hierarchy of multiple scales. Methods in Ecology and Evolution, 7, 1152–1163.


## Not run: 

# First case study (community level, bird diversity):
data(ecomor, package="ade4")
# taxonomic dissimilarities between species
dtaxo <- dist.taxo(ecomor$taxo)
# quadratic entropy
QE(t(ecomor$habitat), dtaxo, formula="EDI")
QE(t(ecomor$habitat), dtaxo^2/2, formula="QE")
table.value(as.matrix(discomQE(t(ecomor$habitat), dtaxo, formula="EDI")))
EDIcom <- discomQE(t(ecomor$habitat), dtaxo, formula="EDI")
QEcom <- discomQE(t(ecomor$habitat), dtaxo^2/2, formula="QE")

# display of the results
bird.QE <- QE(t(ecomor$habitat), dtaxo, formula="EDI")
dotchart(bird.QE$diversity, labels = rownames(bird.QE), 
    xlab = "Taxonomic diversity", ylab="Habitats")

# Second case study (population level, human genetic diversity):
data(humDNAm, package="ade4")
# quadratic entropy
QE(t(humDNAm$samples), humDNAm$distances/2, formula="QE")
QE(t(humDNAm$samples), sqrt(humDNAm$distances), formula="EDI")
QEhumDNA.dist <- discomQE(t(humDNAm$samples), 
humDNAm$distances/2, humDNAm$structures)

EDIhumDNA.dist <- discomQE(t(humDNAm$samples), 
sqrt(humDNAm$distances), humDNAm$structures, formula="EDI")


# display of the results
hum.QE <- QE(t(humDNAm$samples), humDNAm$distances/2, formula="QE")
dotchart(hum.QE$diversity, labels = rownames(hum.QE), 
    xlab = "Genetic diversity", ylab="Populations")


## End(Not run)

[Package adiv version 2.1.1 Index]