Find and fix small rounding errors in ultrametric trees
Source:R/checkAndFixUltrametric.R
checkAndFixUltrametric.RdcheckAndFixUltrametric finds and correct small numerical errors that
might appear in ultrametric trees that where created through simulations.
This function should never be used as a formal statistical method to make a
tree ultrametric, as it was designed just to correct small rounding errors.
References
Paradis, E. (2012). Analysis of Phylogenetics and Evolution with R (Vol. 2). New York: Springer.
Popescu, A. A., Huber, K. T., & Paradis, E. (2012). ape 3.0: New tools for distance-based phylogenetics and evolutionary analysis in R. Bioinformatics, 28(11), 1536-1537.
Examples
S <- 1
E <- 0
set.seed(1)
phy <- simulateTree(pars = c(S, E), max.taxa = 6, max.t = 5)
phy$edge.length[1] <- phy$edge.length[1]+0.1
ape::is.ultrametric(phy)
#> [1] FALSE
phy <- checkAndFixUltrametric(phy)
ape::is.ultrametric(phy)
#> [1] TRUE