# setwd("D:/one_drive_Zhanyou_homePC/OneDrive/PH.D related Documents/Dissertation/2_paper_ISU") # setwd("~/OneDrive/PH.D related Documents/Dissertation/2_paper_ISU/") setwd("~/Box/Manuscripts/Soy/2_paper_ISU/R_codes/R_code_for_supllementalMaterials -PLOS One/draw_figures_for_2nd_paper_Fig5") AUC_Accuracy_Data= read.csv("for cruskals and t-test_paper2_VIP_format_long_with_RF_PLR_NEW.csv") # change rrBLUP to RR AUC_Accuracy_Data$Models[AUC_Accuracy_Data$Models=="rrBLUP"]="RR" head(AUC_Accuracy_Data) dim(AUC_Accuracy_Data) table(AUC_Accuracy_Data$Models) AUC_Accuracy_Data= AUC_Accuracy_Data[!AUC_Accuracy_Data$Models%in%c("Precision_SVM", "Sensitivity_RF", "Specificity_SVM"),] dim(AUC_Accuracy_Data) table(AUC_Accuracy_Data$EP) library(agricolae) print(kruskal(AUC_Accuracy_Data$Values, AUC_Accuracy_Data$Models)) AUCs= AUC_Accuracy_Data[AUC_Accuracy_Data$EP =="AUC",] table(AUCs$Models) accs= AUC_Accuracy_Data[AUC_Accuracy_Data$EP =="Accuracy",] dim(accs) print(kruskal(AUCs$Values, AUCs$Models)) print(kruskal(accs$Values, accs$Models)) table(accs$Models) if(!require("ggpubr")){ install.packages("ggpubr", dependencies = T); library(ggpubr)} my_comparisons= list(c("RR", "LR"), c("LR", "KNN") , c("RR", "KNN"), c("RR", "SVM"), c("RR", "NB"),c("RR","BGLR"), c("RR", "ANN"),c("RR", "PLR"), c("RR", "GBM"),c("RR", "RF")) ggboxplot(AUCs, x= "Models", y = "Values", panel.labs =list(c("")),xlab = "",ylab = "AUC", fill = "Models", order = c("RR", "LR", "KNN","SVM","NB","BGLR","ANN","PLR", "GBM", "RF"), font.label = list(size = 19, face = "bold", color ="red")) + stat_compare_means(comparisons =my_comparisons,method = "t.test",paired = F,size =5, label.y = c(0.825,0.63,0.87,0.92, 0.95, 0.98,1.02, 1.06, 1.1, 1.14 ))+ theme(legend.position = "none") + stat_compare_means(label.y = 1.22, label.x = "LR", size=6) + font("title", size = 14, color = "red", face = "bold.italic")+ font("subtitle", size = 10, color = "black", face = "bold")+ font("caption", size = 10, color = "orange")+ font("xlab" , size = 18, color = "black", face = "bold")+ rotate_x_text(angle = 20)+ font("ylab", size = 12, color = "black", face = "bold")+ font("xy.text", size = 13, color = "black", face = "bold")