Re: [R-sig-phylo] ace in ape how to derive ancestral states (which.max)

2013-03-21 Thread Liam J. Revell
One final comment on this. Since the conditional scaled likelihoods of the subtree and the marginal ancestral state reconstruction are equivalent at the root node of the tree, a computationally simple (but slow) method for getting the marginal ancestral state reconstructions is to move the root

Re: [R-sig-phylo] ace in ape how to derive ancestral states (which.max)

2013-03-20 Thread Liam J. Revell
Just to follow up on ace(...,type="discrete"), which I believe is not doing what many people think it is doing: http://blog.phytools.org/2013/03/conditional-scaled-likelihoods-in-ace.html. Please don't take this as a criticism of ace - but I believe that the difference between conditional, mar

Re: [R-sig-phylo] ace in ape how to derive ancestral states (which.max)

2013-03-20 Thread Liam J. Revell
Hi Andres. To answer your question at its face value, the line of code you want is: anc<-setNames(apply(ANC$lik.anc,1,function(x) names(which.max(x))),length(tree$tip.label)+1:tree$Nnode) (The setNames ensures that your resultant vector gets the node numbers for names.) This message really

[R-sig-phylo] ace in ape how to derive ancestral states (which.max)

2013-03-20 Thread Andrés Parada
Sorry if this was addressed before. I reconstructed a binary discrete character with* ace* (coded as 0-1). As suggested in APER 2nd edition with the* Sylvia *case I can obtain the "lik.anc" values but I wanted to derive the ancestral states from this matrix. *First* *ANC <- ace (data$character,