Dear Rafa.
Try this to get the transition matrix, Q:
k<-nrow(ace$index.matrix)
Q<-matrix(ace$rates[ace$index.matrix],k,k)
diag(Q)<--rowSums(Q,na.rm=TRUE)
This should match what you get running:
as.Qmatrix(fitMk(tree,x,model="ARD"))
with phytools.
All the best, Liam
Liam J. Revell
University of Massachusetts Boston [Assoc. Prof.]
Universidad Católica de la Ssma Concepción [Adj. Res.]
On 6/7/2021 6:52 PM, Rafael S Marcondes wrote:
EXTERNAL SENDER
Hi all,
I'm very confused trying to understand the output of ace::ape, specifically
the transition rates. I'm having a hard time understanding how the rates
are stored in the results.
For example, I used an ARD model on a trait with three states, denoted just
0, 1 and 2.
I know that the rates are stored in $rates and the indices of $rates are
given in $index.matrix:
ace$index.matrix
[,1] [,2] [,3]
[1,] NA35
[2,]1 NA6
[3,]24 NA
ace$rates
[1] 0.107923960 0.012997878 0.0 0.008488054 0.0 0.073339853
But how do the ace$index.matrix columns and rows correspond to my character
states?
Thanks for any help!
Rafa
*--*
*Rafael Sobral Marcondes, Ph.D.*
Pronouns: he/him
*"Eu quase que nada não sei. Mas desconfio de muita coisa"*
*"I almost don't know nothing. But I suspect many things"*
-João Guimarães Rosa, Brazilian novelist
(Portuguese original and free English translation by me)
[[alternative HTML version deleted]]
___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=04%7C01%7Cliam.revell%40umb.edu%7C95354f087a314328586808d92a070658%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637587031952745482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=MpJuKhub05VZQOWBn0HY8OIOIm4cSeez00A%2FWvPFWyM%3Dreserved=0
Searchable archive at
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=04%7C01%7Cliam.revell%40umb.edu%7C95354f087a314328586808d92a070658%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637587031952745482%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=6crcPjrShW98xiu%2FYtB06ygMmY2Uurg3niR951K4Src%3Dreserved=0
___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/