Learn R Programming

HelpersMG (version 5.1)

DIx: Return an index of quantitative asymmetry and complexity named Developmental Instability Index (DIx)

Description

Return an index of quantitative asymmetry and complexity. Higher is the value, higher is the complexity (number of objects) and diversity (difference between them). The indice is based on the product of the average angular distance of Edwards (1971) for all permutations of measures for both sides with the geometric mean of the inverse of Shannon entropy H for both sides. Let p1 and p2 two vectors of relative measures of objects with sum(p1) = 1 and sum(p2)=1 and n1 being the number of objects in p1 and n2 being the number of objects in p2. Edwards distance for all permutations of p1 and p2 objects are computed and the average value E is calculated. The maximun possible Shannon index for identical n1 is max1 = sum((1/n1) * log(1/n1)). Shannon index is v1 = sum(p1 * log(p1)). If version == 2, the complementary of Shannon index for these n1 objects is used: c1 = 2 * max1 - v1 If version == 1, the Shannon index is used directly. The geometry mean between both sides defined the measure of diversity within each side: S=sqrt(c1 * c2) The Developmental Instability Index is then S * E

Usage

DIx(l1, l2, details = FALSE, version = 1)

Arguments

l1

Set of measures at one side of an organism

l2

Set of measures at the other side of an organism

details

If TRUE, will show the details of computing

version

Can be 1 or 2; see description

Value

A numeric value

Details

DIx returns an index of quantitative asymmetry and complexity

References

Edwards, A.W.F., 1971. Distances between populations on the basis of gene frequencies. Biometrics 27, 873<U+2013>881. Shannon C.E. 1948 A mathematical theory of communication. Bell System Technical Journal 27(3), 379-423.

Examples

Run this code
# NOT RUN {
l1 <- c(0.1, 0.1, 0.05, 0.2, 0.3, 0.25)
l2 <- c(0.2, 0.3, 0.5)
DIx(l1, l2)

l1 <- c(0.1, 0.1, 0.05, 0.2, 0.3, 0.25)
l2 <- c(0.1, 0.1, 0.05, 0.2, 0.3, 0.25)
DIx(l1, l2)

l1 <- c(0.2, 0.3, 0.5)
l2 <- c(0.2, 0.3, 0.5)
DIx(l1, l2)

l1 <- c(0.2, 0.2, 0.2, 0.2, 0.2)
l2 <- c(0.2, 0.3, 0.5)
DIx(l1, l2)

l1 <- c(0.2, 0.2, 0.2, 0.2, 0.2)
l2 <- c(0.3333, 0.3333, 0.3333)
DIx(l1, l2)

l1 <- c(0.2, 0.2, 0.2, 0.2, 0.2)
l2 <- c(0.2, 0.2, 0.2, 0.2, 0.2)
DIx(l1, l2)

l1 <- c(0.3333, 0.3333, 0.3333)
l2 <- c(0.3333, 0.3333, 0.3333)
DIx(l1, l2)
# }

Run the code above in your browser using DataLab