spider (version 1.5.0)

tree.comp: Tree comparisons

Description

Compares the clades between two trees.

Usage

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

Arguments

phy1, phy2

Trees of class `phylo' to compare.

method

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

Value

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.

Details

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.

References

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

See Also

node.depth, dist.topo.

Examples

Run this code
# NOT RUN {
set.seed(15)
tr <- ape::rtree(15)
set.seed(22)
tr2 <- ape::rtree(15)
tree.comp(tr, tr2)
tree.comp(tr, tr2, method="PH85")
tree.comp(tr, tr2, method="shallow")

# }

Run the code above in your browser using DataLab