## Toy Exemple
set.seed(123)
# Generating a random tree
tree<-pbtree(n=25)
# Setting the regime states of tip species
sta<-as.vector(c(rep("Forest",10),rep("Savannah",15))); names(sta)<-tree$tip.label
# Making the simmap tree with mapped states
tree<-make.simmap(tree,sta , model="ER", nsim=1)
col<-c("blue","orange"); names(col)<-c("Forest","Savannah")
# Plot of the phylogeny for illustration
plotSimmap(tree,col,fsize=0.6,node.numbers=FALSE,lwd=3, pts=FALSE)
# 2 Random traits evolving along the phylogeny
data<-data.frame(head.size=rTraitCont(tree), mouth.size=rTraitCont(tree))
# Names of the species
rownames(data)<-tree$tip.label
## Run the analysis!!
# BM model with multiple regimes
mvBM(tree,data)
# BM model with a single rate per trait
mvBM(tree,data, model="BM1")
# Comparing evolutionary rates between traits with a constrained BM model (see details)
# see Adams (2013)
mvBM(tree,data, model="BM1", constraint=TRUE)
mvBM(tree,data, model="BMM", constraint=TRUE)
Run the code above in your browser using DataLab