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

[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,

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