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 nodes) in the tree, and then at each event (that is, a speciation or extinction), it counts the number of edges that include that time point. This is slow. It seems likely that Emmanuel's suggestion (in a previous email) to use dist.nodes() would run much faster than this.

- Liam

--
Liam J. Revell
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://phytools.blogspot.com

On 8/11/2011 12:42 AM, Rob Lanfear wrote:
Hi Liam,

Thanks for the help. Extremely useful.

And thanks for clearing up my lack of understanding about the
differences in maximum ages!

Cheers,

Rob

On 11 August 2011 14:05, Liam J. Revell <liam.rev...@umb.edu
<mailto:liam.rev...@umb.edu>> wrote:

    Hi Rob.

    I can reproduce your error, but I haven't figured out the problem yet.

    You can try an earlier version of this function, which seems to work:

    
source("http://anolis.oeb.__harvard.edu/~liam/R-__phylogenetics/ltt/v0.3/ltt.R
    <http://anolis.oeb.harvard.edu/~liam/R-phylogenetics/ltt/v0.3/ltt.R>")

    p2 <- ltt(t1, log.lineages=FALSE, drop.extinct=FALSE)

    Sorry about this.

    Also:


    max(p1$times)==max(p2$times)

    can be FALSE because if drop.extinct is set to TRUE, then the crown
    age of the pruned tree can be smaller than in the full tree if some
    lineages arising at the root of the tree do not leave any extant
    descendants.


    - Liam

    --
    Liam J. Revell
    University of Massachusetts Boston
    web: http://faculty.umb.edu/liam.__revell/
    <http://faculty.umb.edu/liam.revell/>
    email: liam.rev...@umb.edu <mailto:liam.rev...@umb.edu>
    blog: http://phytools.blogspot.com

    On 8/10/2011 9:50 PM, Rob Lanfear wrote:

        library(TreeSim)

        library(phytools)

        library(geiger)


        #simulate tree of 100 taxa with initial diversification followed
        by a
        period of B=D

        t1 <- sim.rateshift.taxa(100, 1, c(0.2, 0.2), c(0.2, 0.05),
        c(1,1), c(0,
        20))[[1]]

        t1


        #confirm number of extant taxa is 100

        n.extant<- length(prune.extinct.taxa(t1)$__tip.label)

        n.extant


        #do ltt plot without extinct taxa (works fine)

        p1<- ltt(t1, log.lineages=FALSE, drop.extinct=TRUE)


        #do ltt plot with extinct taxa (looks odd)

        p2<- ltt(t1, log.lineages=FALSE, drop.extinct=FALSE)


        #max times don't seem to correspond between the two plots.

        max(p1$times)==max(p2$times)





--
Rob Lanfear
Postdoc,
Centre for Macroevolution and Macroecology,
Research School of Biology,
Australian National University

Tel: +61 2 6125 7270
www.robertlanfear.com <http://www.robertlanfear.com>

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to