## 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!
# OU model with unique optima
mvOU(tree,data, model="OU1", scale.height=TRUE)
# Analysis with multiple optima!
mvOU(tree,data, scale.height=TRUE)
Run the code above in your browser using DataLab