Learn R Programming

phylotools (version 0.1.2)

meangini: Mean Gini coefficient

Description

Calculating the inequality of clade insufficient sampling Gini coefficient using Monte Carlo simulations

Usage

meangini(tree, subtree, times = 1000, plot = FALSE)

Arguments

tree
A phylogenetic tree in class 'phylo' as in package 'ape'
subtree
A phylogenetic tree in class 'phylo', but have fewer tips than the input 'tree'.
times
Times for calculating the Gini coefficient
plot
Whether to plot the cutting pattern and the histogram

Value

returns a list with the first the mean for all value, and the second a vector representing the all Gini coefficient for each randomly cutting pattern.

Details

This function could be used to calculating the inequality of clade insufficient sampling. The inequality can be measured by Gini coefficient, which is frequently used in economy. The Gini coefficient is based on Lorenz's curve, and the range of this coefficient is between 0 and 1. The more lower the value, the more equality the distribution is. A random time between the oldest node and the latest node in the phylogenetic tree was generated, and the phylogenetic tree was divided into two to n clades according to the time. For each clade in each "cutting" pattern, number of tips that can not be found in the perfect phylogenetic tree was recorded as number of "missing" tips. The number of missing tips was further divided by the number of expectation in the clade in perfect sampling tree. This ratio was calculated for each clade.The Gini coefficient was calculated for these values to represent the inequality of species that not included among clades. This procedure will be replicated for 1000 times in default and require intensively computationally power, this may last for minutes, even in handling small phylogenetic trees. Therefore, please be patient on the time consuming task.

References

Jinlong Zhang, Nathan Swenson, Xiangcheng Mi, Jihong Huang, Keping Ma, The imperfect sampling and the accuracy of phylogenetic patterns in communities.

See Also

gini

Examples

Run this code

data(bird.orders)
to.drop <- c("Craciformes", "Galliformes", "Gruiformes")
dropped <- drop.tip(bird.orders, to.drop)
meangini(tree = bird.orders, subtree = dropped, times = 10, plot = TRUE)
meangini(tree = bird.orders, subtree = dropped, times = 50, plot = TRUE)
meangini(tree = bird.orders, subtree = dropped, times = 100, plot = TRUE)
meangini(tree = bird.orders, subtree = dropped, times = 200, plot = TRUE)

Run the code above in your browser using DataLab