sShapeI | R Documentation |

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

```
sShapeI(tree, logbase = 2)
```

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

`logbase` |
The logarithm base that shall be used. |

`sShapeI`

returns the s-shape statistic of the given tree.

Luise Kuehn

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.

```
tree <- ape::read.tree(text="((((,),),(,)),(((,),),(,)));")
sShapeI(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.