Closed SimonGreenhill closed 2 years ago
Should be added now! Let me know if it works.
library(corHMM) # follow example in corHMM docs
library(phytools)
data(primates)
phy <- primates[[1]]
phy <- multi2di(phy)
## make character with character labels
data <- data.frame(
Genus_sp=phy$tip.label,
Trait=sample(x=c("A", "B"),size=Ntip(phy), replace=TRUE)
)
##run corhmm
MK <- corHMM(phy, data, 1, collapse = FALSE)
model <- MK$solution
simmap.corhmm <- makeSimmap(tree=phy, data=data, model=model/500, rate.cat=1, nSim=1, nCores=1, fix.node = c(61, 62, 63, 64, 65), fix.state = c(2, 2, 2, 2, 2))
phytools::plotSimmap(simmap.corhmm[[1]])
you've made my day - thank you!
It would be awesome if the
makeSimmap
function could fix node states in the same way thatcorHMM
does. CurrentlymakeSimmap
only allows you to fix a single node withfix.node/fix.state
. I have two nodes I want to fix :)