Hi Lior. I'm working on this for you now.
Basically a lot of optimization iterations with /rateshift/ tend to fail, so I'm basically doing two things: (1) preventing a failed optimization from causing the whole run to fail using /try/; and (2) allowing the user to parallelize the multiple optimization iterations using /foreach/. When I get both of these fixes working I'll push the update to the /phytools/ GitHub and you can install the package from there. All the best, Liam Liam J. Revell Professor of Biology, University of Massachusetts Boston Web: http://faculty.umb.edu/liam.revell/ Book: Phylogenetic Comparative Methods in R <https://press.princeton.edu/books/phylogenetic-comparative-methods-in-r> (/Princeton University Press/, 2022) On 5/16/2023 9:57 AM, Lior Glick wrote: > CAUTION: EXTERNAL SENDER > Hello, > I am trying to run the rateshift function from phytools on a rather > large phylogeny (500 species). > With nrates=1 (null model) everything works fine. Using nrates=2 also > completed successfully, but did not reach convergence: > > bm_multi = rateshift(tree, data, nrates=2) > > bm_multi$convergence > 0 > > I therefore tried to increase to niter=100, but then I got the > following error: > Optimization progress: > |........Error in solve.default(model2$hessian) : > Lapack routine dgesv: system is exactly singular: U[3,3] = 0 > Calls: rateshift > Execution halted > > I also tried changing to method='REML' and got a slightly different error: > Optimization progress: > |............................................................................Error > > in optimHess(sig2, lik2, tree = tree, x = x) : > non-finite finite-difference value [2] > Calls: rateshift > Execution halted > > I saw in an old post > <http://blog.phytools.org/2017/10/fix-to-optimization-routine-for-non.html> > that > a similar issue was fixed in fit.bd > <http://fit.bd/>. > Is there any fix for rateshit? Alternatively, has anything similar > been implemented in another function/package? Or any other suggestion > on how to go around this? > > Thanks! > > _______________________________________________ > R-sig-phylo mailing list -R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive athttp://www.mail-archive.com/r-sig-phylo@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/