cophen.index: Computes the cophenetic balance index of a phylogenetic tree

Description Usage Arguments Details Value Author(s) References Examples

View source: R/cophen.index.R

Description

Given a phylogenetic tree, computes the cophenetic balance index of that phylogenetic tree.

Usage

1

Arguments

tree

a single phylogenetic tree. It can be entered as a string the Newick format, as a 'phylo' object (ape package) or as an 'igraph' object (igraph package).

norm

a logical variable that indicates whether the index should be normalized or not.

Details

The cophenetic index is computed as the sum of the depths of the least common ancestor (LCA) of every pair of leaves.

Value

A numeric value.

Author(s)

Lucia Rotger

References

A. Mir, F. Rossello, L.Rotger, A new balance index for phylogenetic trees. Mathematical Biosciences 241 (2013), 125-136.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Computation of the cophenetic balance index of trees 
# entered in newick format:
cophen.index("(1,2,3,4,5);")
cophen.index("(1,(2,(3,(4,5))));")

# Computation of the cophenetic balance index of trees 
# entered as a phylo object:
require(ape)
random.tree = rtree(5,rooted=TRUE)
cophen.index(random.tree)

# Computation of the cophenetic balance index of a tree
# entered as a igraph object. The tree is randomly 
# generated from all trees with 5 leaves following
# the alpha-gamma model with alpha=0.5 and gamma=0.3.
a.g.tree = a.g.model(5,0.5,0.3)
cophen.index(a.g.tree)

#All of them can be normalized (values between 0 and 1)
cophen.index("(1,2,3,4,5);",norm=TRUE)
cophen.index("(1,(2,(3,(4,5))));",norm=TRUE)
cophen.index(random.tree,norm=TRUE)
cophen.index(a.g.tree,norm=TRUE)

CollessLike documentation built on Oct. 30, 2019, 12:05 p.m.