Hello all, this may come be surprising to many, but consulting the manual ?is.ultrametric can be helpful. Why not simply try e.g. is.ultrametric(tree, tol=.01) ???? So in this sense RTFM Regards, Klaus
On Aug 16, 2016 9:31 AM, "Martin Dohrmann" <m.dohrm...@lrz.uni-muenchen.de> wrote: > > Am 16.08.2016 um 15:20 schrieb Joseph W. Brown: > > > I agree that it is almost certainly numerical precision, as rescaling > the tree fixes things: > > > > > is.ultrametric(phy); > > [1] FALSE > > > fie <- phy; > > > fie$edge.length <- fie$edge.length * 0.1; > > > is.ultrametric(fie); > > [1] TRUE > > > > I’ve also tested the ultrametricity(?) with a non-R program and the > results are the same. So can we assume this is not a PhyloBayes issue, and > rather an unavoidable problem with large, old trees? But the fact that > MrBayes trees are ultrametric is confusing; does MrBayes use less precise > edge lengths? > > Actually the MrBayes branch lengths appear to be MORE precise. > > Martin > > >> > >> On 16 Aug, 2016, at 08:53, Liam J. Revell <liam.rev...@umb.edu> wrote: > >> > >> Hi Martin. > >> > >> Since you are writing & reading trees to file, my guess is that it has > to do with numerical precision - that is, the rounding of your edge lengths > when they are written to file. > >> > >> Does your tree look ultrametric when plotted in R? If so, this is > probably the case. > >> > >> My recommendation is that you use phangorn to compute the non-negative > least-squares edge lengths with the condition that the tree is ultrametric. > This will give you the edge lengths that result in the distances between > taxa with minimum sum of squared differences from the distances implied by > your input tree, under the criterion that the resulting tree is ultrametric. > >> > >> To do this you need to merely run: > >> > >> library(phytools) > >> library(phangorn) > >> is.ultrametric(tree) ## fails > >> plotTree(tree,ftype="off") ## does my tree look ultrametric? > >> nnls<-nnls.tree(cophenetic(tree),tree,rooted=TRUE) > >> is.ultrametric(tree) ## should pass > >> > >> Let us know if this works. All the best, Liam > >> > >> Liam J. Revell, Associate Professor of Biology > >> University of Massachusetts Boston > >> web: http://faculty.umb.edu/liam.revell/ > >> email: liam.rev...@umb.edu > >> blog: http://blog.phytools.org > >> > >> On 8/16/2016 6:41 AM, Martin Dohrmann wrote: > >>> Hi, > >>> I want to do some diversification pattern analyses with various R > packages. I'm using a time-calibrated tree produced by PhyloBayes. Branch > lengths are in millions of years and all taxa are extant, so the tree > should be ultrametric. However, when I call "is.ultrametric", it returns > "FALSE". > >>> > >>> Has anybody encountered something like this? Any ideas about what's > going on/how to solve this? > >>> > >>> Some further information: > >>> I also tried other PhyloBayes time trees, with the same result. In > contrast, MrBayes time trees I tried for comparison are recognized as > ultrametric. Regarding my diversification analyses, TESS would not run, > telling me "The likelihood function is only defined for ultrametric > trees!". On the other hand, BAMMtools doesn't seem to have a problem with > my tree. I haven't tried other packages yet, but I suspect RPANDA, TreePar > etc. might also have issues if they don't recognize my tree as ultrametric. > >>> > >>> I'd appreciate any help! > >>> > >>> Best wishes, > >>> Martin > >>> > >>> Dr. Martin Dohrmann > >>> Ludwig-Maximilians-University Munich > >>> Dept. of Earth & Environmental Sciences > >>> Palaeontology & Geobiology > >>> Molecular Geo- & Palaeobiology Lab > >>> Richard-Wagner-Str. 10 > >>> 80333 Munich, Germany > >>> Phone: +49-(0)89-2180-6593 > >>> > >>> > >>> [[alternative HTML version deleted]] > >>> > >>> _______________________________________________ > >>> R-sig-phylo mailing list - R-sig-phylo@r-project.org > >>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > >>> Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > >>> > >> > >> _______________________________________________ > >> R-sig-phylo mailing list - R-sig-phylo@r-project.org > >> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > >> Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > > > > Dr. Martin Dohrmann > Ludwig-Maximilians-University Munich > Dept. of Earth & Environmental Sciences > Palaeontology & Geobiology > Molecular Geo- & Palaeobiology Lab > Richard-Wagner-Str. 10 > 80333 Munich, Germany > Phone: +49-(0)89-2180-6593 > > > [[alternative HTML version deleted]] > > > _______________________________________________ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/