B2I: Calculation of the B2 index for rooted trees

View source: R/B2I.R

B2IR Documentation

Calculation of the B2 index for rooted trees


This function calculates the B2 index B2(T) for a given rooted tree T. The tree must not necessarily be binary. B2(T) is defined as

B2(T)=-\sum_{x\in V_L(T)} p_x\cdot log(p_x)

in which V_L(T) denotes the leaf set of T, and in which

p_x=\prod_{v\in anc(x)} \frac{1}{|child(v)|}

denotes the probability of reaching leaf x when starting at the root and assuming equiprobable branching at each vertex v\in anc(x) with anc(x) denoting the set of ancestors of x excluding x. child(v) denotes the set of children of the inner vertex v.
The B2 index is a balance index.

For n=1 the function returns B2(T)=0 and a warning.

For details on the B2 index, see also Chapter 11 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_11).


B2I(tree, logbase = 2)



A rooted tree in phylo format.


The base that shall be used for the logarithm. For binary trees it is common to use base 2.


B2I returns the B2 index of the given tree.


Sophie Kersting, Luise Kuehn


K.-T. Shao and R. R. Sokal. Tree Balance. Systematic Zoology, 39(3):266, 1990.
doi: 10.2307/2992186.

P.-M. Agapow and A. Purvis. Power of Eight Tree Shape Statistics to Detect Nonrandom Diversification: A Comparison by Simulation of Two Models of Cladogenesis. Systematic Biology, 51(6):866-872, 2002.doi: 10.1080/10635150290102564.
URL https://doi.org/10.1080/10635150290102564.

M. Hayati, B. Shadgar, and L. Chindelevitch. A new resolution function to evaluate tree shape statistics. PLOS ONE, 14(11):e0224197, 2019. doi: 10.1371/journal.pone.0224197.
URL https://doi.org/10.1371/journal.pone.0224197.

M. Kirkpatrick and M. Slatkin. Searching for evolutionary patterns in the shape of a phylogenetic tree. Evolution, 47(4):1171-1181, 1993. doi: 10.1111/j.1558-5646.1993.tb02144.x.


tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")

treebalance documentation built on May 29, 2024, 1:15 a.m.

Related to B2I in treebalance...