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 at http://www.mail-archive.com/[email protected]/