emmanuelparadis / ape

analysis of phylogenetics and evolution

Home Page:http://ape-package.ird.fr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: cannot use same sampling date for all the tips

aguilar-gomez opened this issue · comments

I tried running rtt() to root my tree. I have tips with the same sampling date so I want to use a vector of 0. I tried different things and using the same sampling date for all produces the following error:

Error in cor.test.default(y, x) : 'x' and 'y' must have the same length
In addition: There were 50 or more warnings (use warnings() to see the first 50)

The following code works:

sampling_dates<-c(0,0,0,0,0,0,0,0,0,1)
newtree<-rtt(tree,tip.dates=sampling_dates)

So just setting one of the sampling dates to a different thing makes it work. Is there a reason why setting all to zero should not work?

Hi @aguilar-gomez,
you can change the argument objective="rms" or objective="rsquared", which both should work. The default of rtt() is objective="cor", which computes the correlation between the sampling dates and the values derived from the different rooted trees and this implicitly assumes that sampling dates differ.
But you better use an algorithm which returns an ultrametric tree in the first place.
Kind regards,
Klaus

PS: The development version in this repository has an improved version of rtt which is considerably faster. So you might try to install it.