Hi all. Yes, Michael is correct. To get the 95% confidence intervals on the estimates (which, as Brian points out, are conditioned on the correctness of the model -- so can still be too small if the model is badly wrong) you just need to set the /phytools::fastAnc/ argument /CI=TRUE/. You can also graph confidence intervals on the node state estimates in a /contMap/ plot using /errorbar.contMap/.
As others have noted, the names & row names of the /$ace/ and /$CI95/ elements of your /"fastAnc"/ object from /phytools/ are the indices of the nodes in the input /"phylo"/ object. If your tree is small, you can easily see which nodes match to which indices by running /ape::nodelabels()/ after graphing your tree using /ape::plot.phylo/, /phytools::plotTree/, or even /phytools::contMap/. You can also using /ape::mrca/, /ape::getMRCA/, or /phytools::findMRCA/ to identify the node indices that correspond to the MRCA of a set of taxa. (If you want to get fancy, /phytools/ also has a function called /get.treepos/ which allows you to interactively click on your plotted tree and returns an object that includes the index of the closest node to your click.) Lastly, if your tree has node labels, then the values of /tree$node.label/ should be in the numeric order of the node indices which go from /N/+1 to /N+m/ for /N/ tips and /m/ internal nodes. I hope this is helpful! Best wishes, 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 11/20/2025 7:05 PM, Michael Zyphur wrote: > CAUTION: EXTERNAL SENDER > > Hi Jaime > > I think you can stay in phytools and get what you want. contMap() is just > visualizing the ML node states from fastAnc() under a Brownian model. So if > you had something like: > > fit <- phytools::fastAnc(tree, x, CI = TRUE) > node <- ape::getMRCA(tree, c("tipA","tipB")) > fit$ace[as.character(node)] > fit$CI95[as.character(node), ] > > then fit$ace is named by node number, so the MRCA returned by getMRCA() > gives you the ancestral growth-rate estimate and its 95% CI directly, > analogous to Brian’s ace() example. > > I'd be curious to hear what others think. > > > Best wishes > > Michael Zyphur > Professor and Director > Instats | instats.org > Follow Instats: Bluesky<https://bsky.app/profile/instats.bsky.social> > Linkedin<https://www.linkedin.com/company/81837504/admin/dashboard/> > Facebook<https://www.facebook.com/InstatsTraining/> > > > On Fri, 21 Nov 2025 at 10:30, O'Meara, Brian via R-sig-phylo < > [email protected]> wrote: > >> It might be easier to use ace() in ape. A major advantage is it gives you >> the uncertainty in the estimates, which is often substantial (and even so >> still an underestimate, since there could be trends that aren't fit at all). >> >> library(ape) >> data(bird.orders) >> x <- rnorm(23) >> reconstruction <- ace(x, bird.orders) >> >> and then you have the states at each node (with the node numbers): >> >> print(reconstruction$ace) >> >> and the confidence intervals: >> >> print(reconstruction$CI95) >> >> There are various ways to get node numbers for the node you care about; >> perhaps the easiest is by specifying a pair of tips: >> >> ape::getMRCA(bird.orders, c("Struthioniformes", "Tinamiformes")) >> >> which will tell you the relevant node number of the reconstructions (the >> label for the vector, not the index (i.e., use reconstruction$ace["26"] >> with the quotes). >> >> Hope this helps (and love to phytools in general, even if not the tool for >> this), >> Brian >> >> >> From: R-sig-phylo<[email protected]> on behalf of Jaime >> Adrian Cordova via R-sig-phylo<[email protected]> >> Date: Thursday, November 20, 2025 at 6:00 PM >> To:[email protected] <[email protected]> >> Subject: [R-sig-phylo] Phytools connect ace values to tree >> >> Hi colleagues, >> >> I've conducted an ancestral state reconstruction for E.coli growth rates >> under anaerobic conditions using phytools. I'd like to get a bit more >> detail out of reconstruction, particularly with the ancestral values; >> however, I'm not exactly sure how to match the values to the nodes in the >> phylogeny. In other words, I'm able to map the values onto the map using >> contMap(), but I would like to be able to say that the MRCA of a phylogroup >> is predicted to have a certain growth rate, etc. >> >> Can someone help me with this? Thanks! >> >> Kind regards, >> Jaime >> >> Jaime A. Cordova Jr. >> Pronouns: he/him/his/�l >> Genetics PhD Candidate, Perna Lab >> University of Wisconsin, Madison >> NASA/JPL Solar System Ambassador >> >> I tend to work at irregular hours, but I never expect others to do the >> same. If I email you outside of your working hours, please do not feel >> obligated to respond until you are comfortable doing so. >> >> [[alternative HTML version deleted]] >> >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> R-sig-phylo mailing list [email protected] >> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo >> Searchable archive at >> http://www.mail-archive.com/[email protected]/ >> > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-phylo mailing list [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive athttp://www.mail-archive.com/[email protected]/ [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/[email protected]/
