Re: [R-sig-phylo] LTT plot non-ultrametric trees

2011-08-11 Thread Nick Matzke
Somewhere I wrote a function that samples at a series of user-set timepoints and counts the # of lineages crossing each timepoint -- this is pretty flexible, allows for increases/decreases in diversity etc., let me know if the other options aren't working for you I can dig it up... On

Re: [R-sig-phylo] LTT plot non-ultrametric trees

2011-08-11 Thread Liam J. Revell
Hi Rob. Thanks for identifying the bug. This should be fixed, I hope, in the newest version of phytools (v0.0-6; available: http://anolis.oeb.harvard.edu/~liam/R-phylogenetics/). The way this function works is by first computing the heights above the root of all the nodes (including tip

Re: [R-sig-phylo] LTT plot non-ultrametric trees

2011-08-11 Thread Rob Lanfear
Hi Liam, Emmanuel, Nick, et al Thanks for all the help. Liam, I can confirm that your new function works fine on all the trees I've tested (about 20). Thanks! Some of my trees are pretty large (a few thousand taxa), so for interest's sake I coded up Emmanuel's suggestion too. The code is below

Re: [R-sig-phylo] LTT plot non-ultrametric trees

2011-08-11 Thread Emmanuel Paradis
Hi all, I'll make a new version of ltt.plot() that treats ultrametric and non-ultrametric trees. After all, I don't see a logical reason why both kinds of trees would be treated differently here. I'll add an option backward (FALSE by default) so the time scale can start from the root, and

Re: [R-sig-phylo] LTT plot non-ultrametric trees

2011-08-10 Thread Liam J. Revell
This is implemented in my phytools package. This is not yet on CRAN, but can be downloaded from http://anolis.oeb.harvard.edu/~liam/R-phylogenetics/. The function is ltt(). It is slow, but seems to work. Please let me know if you have success with this. - Liam -- Liam J. Revell

Re: [R-sig-phylo] LTT plot non-ultrametric trees

2011-08-10 Thread Emmanuel Paradis
Hi Liam Rob, You may try using dist.nodes() for this: x - dist.nodes(phy) n - Ntip(phy) ROOT - n + 1 x[ROOT, ] The last command returns the distance from the root to all nodes and tips which are ordered in the usual way. So you may create a vector with +1 for the nodes, -1 for the tips, and