Learn R Programming

treebalance (version 1.2.0)

sShapeI: Calculation of the s-shape statistic for rooted trees

Description

This function calculates the s-shape statistic \(sShape(T)\) for a given rooted tree \(T\). The tree must not necessarily be binary, however \(sShape\) only fulfils the definition of an imbalance index on the space of binary trees. \(sShape(T)\) is defined as $$sShape(T)=\sum_{u\in V_{in}(T)} log(n_u-1)$$ in which \(V_{in}(T)\) denotes the set of inner vertices of \(T\) and \(n_u\) denotes the number of leaves in the pending subtree that is rooted at \(u\). An arbitrary logarithm base can be used (for binary trees it is common to use base 2).

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

For details on the s-shape statistic, see also Chapter 9 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_9).

Usage

sShapeI(tree, logbase = 2)

Value

sShapeI returns the s-shape statistic of the given tree.

Arguments

tree

A rooted tree in phylo format.

logbase

The logarithm base that shall be used.

Author

Luise Kuehn

References

M.G. Blum and O. Francois. Which random processes describe the tree of life? a large-scale study of phylogenetic tree imbalance. Systematic Biology, 2006.

Examples

Run this code
tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")
sShapeI(tree)

Run the code above in your browser using DataLab