Learn R Programming

treebalance (version 1.2.0)

weighL1dist: Calculation of weighted l1 distance index for rooted binary trees

Description

This function calculates the weighted l1 distance index \(D_{l1}(T)\) for a given rooted binary tree \(T\). \(D_{l1}(T)\) is defined as $$D_{l1}(T)=\sum_{z=2}^n z \cdot |f_n(z)-p_n(z)|$$ in which \(n\) denotes the number of leaves of \(T\), \(f_n(z)\) denotes the frequency of pending subtrees of size \(z\) in \(T\) and \(p_n(z)\) is the expected number of pending subtrees of size \(z\) under the Yule model, i.e. \(p_n(z)=\frac{1}{n-1}\) if \(z=n\) and otherwise \(\frac{n}{n-1}\cdot\frac{2}{z\cdot(z+1)}\).

For \(n=1\) the function returns \(D_{l1}(T)=0\).

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

Usage

weighL1dist(tree)

Value

weighL1distI returns the weighted l1 distance index of the given tree.

Arguments

tree

A rooted binary tree in phylo format.

Author

Sophie Kersting

References

M. G. Blum and O. Francois. On statistical tests of phylogenetic tree imbalance: The Sackin and other indices revisited. Mathematical Biosciences, 195(2):141-153, 2005. doi: 10.1016/j.mbs.2005.03.003.

Examples

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

Run the code above in your browser using DataLab