weighL1dist | R Documentation |

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).

```
weighL1dist(tree)
```

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

`weighL1distI`

returns the weighted l1 distance index of the given tree.

Sophie Kersting

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.

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

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.