library(devtools) library(challengeR) data_matrix <- read.csv("C:/Users/a446r/Desktop/csv_files/data_matrix_NaN.csv") # type ?read.csv for help bootstrapSamples <- 10 naTreat = 'na.rm' # naTreat = 0 challenge <- as.challenge(data_matrix, by = "task", algorithm = "alg_name", case = "case", value = "value", na.treat = naTreat, smallBetter = TRUE) ranking1 <- challenge %>% aggregateThenRank(FUN = mean, na.treat = naTreat, ties.method = "min") ranking2 <- challenge %>% rankThenAggregate(FUN = mean, ties.method = "min") ranking3 <- challenge %>% testThenRank(alpha = 0.05, p.adjust.method = "none", na.treat = naTreat, ties.method = "min" ) # Get Consensus Ranking --------------------------------------------------- meanRanks1 <- ranking1 %>% consensus(method = "euclidean") meanRanks2 <- ranking2 %>% consensus(method = "euclidean") meanRanks3 <- ranking3 %>% consensus(method = "euclidean") # Prepare Bootsrapped Versions -------------------------------------------- if (bootstrapSamples > 0) { set.seed(1) rankingBootstrapped1 <- ranking1 %>% bootstrap(nboot = bootstrapSamples) rankingBootstrapped2 <- ranking2 %>% bootstrap(nboot = bootstrapSamples) rankingBootstrapped3 <- ranking3 %>% bootstrap(nboot = bootstrapSamples) ranking1_bootstrap <- rankingBootstrapped1 ranking2_bootstrap <- rankingBootstrapped2 ranking3_bootstrap <- rankingBootstrapped3 } ## Generate the reports # AggregateThenRank ------------------------------------------------------- ranking1 %>% report(consensus = meanRanks1, title = "AggregateThenRank with Na threat", file = "AggregateThenRank", format = "PDF", clean = TRUE, open = FALSE,) # AggregateThenRank with Bootstrap ----------------------------------------- ranking1_bootstrap %>% report(consensus = meanRanks1, title = "AggregateThenRank with Na threat and Bootstrap", file = "AggregateThenRank_bootstrap", format = "PDF", clean = TRUE, open = FALSE,) # RankThenAggregate ------------------------------------------------------- ranking2 %>% report(consensus = meanRanks2, title = "RankThenAggregate with Na threat", file = "RankThenAggregate", format = "PDF", clean = TRUE, open = FALSE,) # RankThenAggregate with Bootstrap ----------------------------------------- ranking2_bootstrap %>% report(consensus = meanRanks2, title = "RankThenAggregate with Na threat and Bootstrap", file = "RankThenAggregate_bootstrap", format = "PDF", clean = TRUE, open = FALSE,) # TestThenRank ------------------------------------------------------------ ranking3 %>% report(consensus = meanRanks3, title = "TestThenRank with Na threat", file = "TestThenRank", format = "PDF", clean = TRUE, open = FALSE,) # TestThenRank with Bootstrap --------------------------------------------- ranking3_bootstrap %>% report(consensus = meanRanks3, title = "TestThenRank with Na threat and Bootstrap", file = "TestThenRank_bootstrap", format = "PDF", clean = TRUE, open = FALSE,)