Following Riana's query, it appeared that the tree she used had no branch lengths. chronos() now check for the presence of branch lengths and returns an explicit error message.



Le 16/12/2016 à 18:20, Emmanuel Paradis a écrit :
Hi Riana,

It's difficult to answer your question.

Can you send some sample data to reproduce this error?



Le 15/12/2016 à 22:58, Riana Rishad Minocher a écrit :

I’m writing with an issue using the chronos function in ape:

I have a rooted supertree of 186 taxa (genetic & linguistic data), and
am trying to time-calibrate with a set of divergence dates (genetic &
linguistic; available for about 1/3 of nodes).

I’m using chronos and calling agemin and agemax from a table of dates:

tree.dated <- chronos(tree, calibration = makeChronosCalib(tree,
node=dat$node, age.min=dat$agemin, age.max=dat$agemax))

I have the following error:

Setting initial dates...
Fitting in progress... get a first set of estimates

Error in nlminb(start.para, f, g, control = opt.ctrl, lower = LOW,
upper = UP) :
  gradient function must return a numeric vector of length 161
In addition: Warning message:
In nlminb(start.para, f, g, control = opt.ctrl, lower = LOW, upper =
UP) :
  NA/NaN function evaluation

I have had a brief look at the chronos function, and cannot determine
where the error is generated. The error message is slightly different
if I alter the substitution model, and seems to trip up at a different
point. I’m not sure if it begins in setting “ini.rate” as this appears
to be where the error appears for model = “discrete”.

I have tried updating ape, altering my set of dates to a few nodes,
removing the date for the root, listing node numbers and ages rather
than calling it from the table, and reading my tree with
and in parenthetic format in case the tree object was problematic.
I’ve noticed that the vector length the gradient function must
generate varies depending on the number of known node ages provided -
but I can’t figure out much more than that.

I was hoping someone had some suggestion on how I can deal with this
error - essentially where the source of the error might be so I can
adjust my input accordingly! Or, alternatively if anyone has a
suggestion for different ways to time-calibrate the tree (other than

Thank you!



R-sig-phylo mailing list -
Searchable archive at

R-sig-phylo mailing list -
Searchable archive at

Reply via email to