tree.comp: Tree comparisons

Description Usage Arguments Details Value Author(s) References See Also Examples


Compares the clades between two trees.


tree.comp(phy1, phy2, method = "prop")


phy1, phy2

Trees of class ‘phylo’ to compare.


One of the following options:

  • "prop"—returns the proportion of clades that are the same between the two trees

  • "shallow"—returns the proportion of shallow clades (clades where node.depth < median node.depth) that are the same between the two trees default of "prop".

  • "PH85"—returns the topological distance of Penny and Hendy (1985).


This function is a modification of the dist.topo function in ape to give similarity between the two trees as a proportion, and to account for the unreliable resolution of deeper nodes that affect some methods of tree construction (such as NJ).

It is important that the tip labels of the two trees are the same. If the tip labels are different between the two trees, the method will not recognise any similarity between them.

This function does not take into account differences in branch length. The "score" method in dist.topo does this if desired.


Numeric vector of length 1.

If method = "prop", the number returned is the proportion of nodes in the first tree for which there is a node in the second that contains the same tips. Higher number represents greater similarity. If it is 1, the trees are identical. If 0, the trees have no similarity whatsoever.

When method = "shallow", only those nodes tipwards of the median node depth are taken into account. This will not be useful for small trees, but may be helpful with larger datasets.

"PH85" is the Penny and Hendy (1985) distance. This measure is the default of dist.topo. In this measure, the smaller the number, the closer the trees are. If the trees are identical, this results in 0.


Samuel Brown <>


Penny, D. and Hendy, M. D. (1985) The use of tree comparison metrics. _Systematic Zoology_ *34* 75-82.

See Also

node.depth, dist.topo.


tr <- rtree(15)
tr2 <- rtree(15)
tree.comp(tr, tr2)
tree.comp(tr, tr2, method="PH85")
tree.comp(tr, tr2, method="shallow")

spider documentation built on Jan. 15, 2017, 2:30 p.m.
Search within the spider package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.