#####A comparative study on karyotypic diversification rate in mammals ###Libraries library("missForest") library("geiger") library("ape") library("caper") library("phytools") ###Imputation Data of Traits imputedMamm<- missForest(trait_table) ### Model of Evolution of rKDMacro and rKDMicro Model_BM<-fitContinuous(Phylogeny_Meredith, rKDMacro, model = "BM") Model_OU<-fitContinuous(Phylogeny_Meredith, rKDMacro, model = "OU") Model_White<-fitContinuous(Phylogeny_Meredith, rKDMacro, model = "white") Model_Delta<-fitContinuous(Phylogeny_Meredith, rKDMacro, model = "delta") Model_Speciacional<-fitContinuous(Phylogeny_Meredith, rKDMacro, model = "kappa") ### PGLS with BM model and OU model for rKDMacro and rKDMicro ##BM Model #In Caper conjdat0<-comparative.data(data=Table_database, phy=Phylogeny_Meredith, names.col='Species.Filo', vcv=T, vcv.dim=3) Model_BM_1 <- pgls(rKDMacro~logBodyMass, conjdat0, lambda='ML') #In geiger matrix<-corBrownian(1,phy=Phylogeny_Meredith) Model_BM_1 <- gls(rKDMacro~logBodyMass, correlation=matrix,data=Table_database) ##OU Model #In geiger matrix<-corMartins(1,phy=Phylogeny_Meredith) Model_OU_1 <- gls(rKDMacro~logBodyMass, correlation=matrix,data=Table_database) ### Reconstruction of the ancestral state maps<-contMap(Phylogeny_Meredith, rKDMacro, res=100, fsize=0.6, ftype=NULL, lwd=2.5, legend=NULL, lims=NULL, outline=F, sig=3, type="phylogram", direction="lefttwards", plot=TRUE) maps$cols[]<-maps$cols[length(maps$cols):1] plot(maps, res=100, fsize=0.3, ftype=NULL, lwd=2.5, legend=NULL, lims=NULL, outline=F, sig=3, type="phylogram", direction="lefttwards")