Description Usage Arguments Value Author(s) References Examples

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)=-∑_{x in V_L(T)} p_x * log(p_x)*

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

*
p_x= ∏_{v in anc(x)} 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.

1 | ```
B2I(tree, logbase = 2)
``` |

`tree` |
A rooted tree in phylo format. |

`logbase` |
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.

1 2 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.