# This function fits two or more different evolutionary variance-covariance matrices (rate matrices) # to different parts of a phylogenetic tree # Takes a tree with a binary or multistate character "painted" on the branches in SIMMAP format # (see read.simmap()) and data for 1 or more continuous characters # Written by Liam J. Revell evol.vcv<-function(scm.tre,dat,maxit=2000){ # require dependencies require(ape) # bookkeeping X<-as.matrix(dat) n<-nrow(X) # number of species m<-ncol(X) # number of traits p<-ncol(scm.tre$mapped.edge) # number of states D<-matrix(0,n*m,m) for(i in 1:(n*m)) for(j in 1:m) if((j-1)*n