stairs2: Calculation of the stairs2 value for rooted binary trees
Description
This function calculates the stairs2 value \(st2(T)\) for a given rooted
binary tree \(T\). It is defined as the mean ratio between the leaf
numbers of the smaller and larger pending subtree over all inner vertices, more precisely
$$st2(T)=\frac{1}{n-1}\cdot\sum_{u \in V_{in}(T)} \frac{n_{u_a}}{n_{u_b}}$$
in which \(V_{in}(T)\) denotes the set of all inner vertices
of \(T\), and in which \(n_{u_a}\geq n_{u_b}\) denote the number of leaves
in the two pending subtrees that are
rooted at the direct descendants of \(u\). The stairs2 value is an imbalance index.
Special cases: For \(n=1\), the function returns \(st2(T)=0\) and a warning.
For details on the stairs2 value, see
also Chapter 23 in "Tree balance indices: a comprehensive survey" (https://doi.org/10.1007/978-3-031-39800-1_23).
Usage
stairs2(tree)
Value
stairs2 returns the stairs2 value of the given tree.
Arguments
tree
A rooted binary tree in phylo format.
Author
Sophie Kersting
References
C. Colijn, J. Gardy. Phylogenetic tree shapes resolve disease transmission patterns. Evolution, Medicine, and Public Health, 2014(1):96-108, 2014. ISSN 2050-6201. doi: 10.1093/emph/eou018.