force.ultrametric: Coerces a phylogenetic tree to be ultrametric

View source: R/utilities.R

force.ultrametricR Documentation

Coerces a phylogenetic tree to be ultrametric

Description

Coerces an object of class "phylo" to be ultrametric.

Usage

force.ultrametric(tree, method=c("nnls","extend"), ...)

Arguments

tree

an object of class "phylo".

method

the method to use to force the tree to be ultrametric. Options are "nnls" (which uses the phangorn function nnls.tree internally), or "extend".

...

optional arguments: principally, message. This argument (if set to FALSE) can be used to suppress the default warning message that force.ultrametric should not be used as a formal statistical method to ultrametricize a tree.

Details

force.ultrametric coerces a non-ultrametric tree to be ultrametric.

This is achieved either by using nnls.tree from the phangorn package to compute the set of edge lengths that result in a minimized sum-of-squares distance between the patristic distance of the output and input trees (method="nnls"); or by simply extending all the external edges of the tree to match the external edge with the greatest total height (method="extend").

Note that neither of these should be treated as formal statistical methods for inferring an ultrametric tree. Rather, this method can be deployed when a genuinely ultrametric tree read from file fails is.ultrametric for reasons of numerical precision.

Value

An ultrametric tree in an object of class "phylo".

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

See Also

is.ultrametric, nnls.tree


phytools documentation built on June 22, 2024, 10:39 a.m.