Hi Klaus,

The default is: is.ultrametric(phy, tol = .Machine$double.eps^0.5). According to ?.Machine this value does not depend on the machine precision. On my laptop, it gives:

R> .Machine$double.eps^0.5
[1] 1.490116e-08

Best,

Emmanuel

Le 16/08/2016 à 18:15, Klaus Schliep a écrit :
We should consider to improve is.ultrametric to use as tolerance a certain
number significant figures (e.g. 8-10 digits). This way tol would only
depend on the tip-to-root distance and not a machine dependent minimal
value. I find the use of significant figures suits really well as a
stopping criterion for example in my ML functions, especially as it works
for small and large trees equally well.

write.tree has an option to define the number of digits, it will be
generally less than the internal representation and I suspect one could
possible export with higher precision from other programs, but will result
in larger file sizes which one has to put in consideration for MCMC /
bootstrap tree files.
As a side note on the developer site of the r-project.org homepage (not
CRAN) is a link to this nice ancient paper (
http://www.validlab.com/goldberg/paper.pdf)

Regards,
Klaus


PS: And Martin of course I am happy with Liam's solution as it uses
phangorn ;)

On Tue, Aug 16, 2016 at 10:22 AM, Joseph W. Brown <josep...@umich.edu>
wrote:

That’s a good tip, but the issue here is that many packages use
is.ultrametric internally with a hard-coded (likely, default) value of tol.
In this case, Martin simply cannot perform the analyses he wants to run
because this option is inaccessible.

JWB
________________________________________
Joseph W. Brown
Post-doctoral Researcher, Smith Laboratory
University of Michigan
Department of Ecology & Evolutionary Biology
Room 2071, Kraus Natural Sciences Building
Ann Arbor MI 48109-1079
josep...@umich.edu



On 16 Aug, 2016, at 10:15, Klaus Schliep <klaus.schl...@gmail.com> wrote:

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/






_______________________________________________
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/

Reply via email to