# This script uses functions in the packages "irr" and "MASS" # The following script performs Schools of Thought Analysis on ranks # provided by the judges f <- file.choose() #get filename rr <- read.csv(f,row.names=1) #read file of judges' raw ranks sr <- apply(rr,MARGIN=2,rank) #scale to canonical form rs <- rowSums(sr) #calculate rank sum borda <- rank(rs) #generate ranks for borda sr <- sr[,order(-cor(sr,borda,method="kendall"))] #reorder by agreement with borda srb <- cbind(sr,borda)[order(borda),] #bind borda to judges' ranks w <- kendall(sr,correct=TRUE) #determine coeff concordance tau <- cor(srb,method="kendall") #calculate tau matrix d <- as.dist((1-tau)/2) #calculate distances ca <- hclust(d,method="average") #determine cluster config mds <- cmdscale(d) #determine mds config x <- mds[,1] #extract x coord for mds y <- mds[,2] #extract y coord for mds plot(ca,ylab="distance") #plot hierarchical clusters plot (x,y,type="n",xlab="",ylab="",xlim=range(x)*1.2, ylim=range(y)*1.2) #set frame for mds map text(x,y,rownames(mds)) #add judge names to mds map # The following script performs Schools of Thought Analysis on results # from the Analytic Hierarchy Process. It then converts the AHP scores to # ranks and performs SOTA again using those ranks. f <- file.choose() #get filename ahp <- read.csv(f,row.names=1) #read file of ahp scores group <- ahp[ ,length(ahp)] #get group scores only (last column) ahps <- ahp[ ,-length(ahp)] #get participant ahp scores only ahps <- ahps[ ,order(-cor(ahps,group))] #reorder by agreement with group ord <- cbind(ahps,group)[order(-group),] #bind participants scores to group pcor <- cor(ord) #calculate pearson cor matrix d <- as.dist((1-pcor)/2) #calculate distances ca <- hclust(d,method="average") #determine cluster config mds <- cmdscale(d) #determine mds config x <- mds[,1] #extract x coord for mds y <- mds[,2] #extract y coord for mds plot(ca,ylab="distance") #plot hierarchical clusters plot (x,y,type="n",xlab="",ylab="",xlim=range(x)*1.2, ylim=range(y)*1.2) #set frame for mds map text(x,y,rownames(mds)) #add judge names to mds map #repeat Schools of Thought Analysis with ahp scores converted to rankings sr <- apply(-ahps,MARGIN=2,rank) #scale to canonical form rs <- rowSums(sr) #calculate rank sum borda <- rank(rs) #generate ranks for borda sr <- sr[,order(-cor(sr,borda,method="kendall"))] #reorder by agreement with borda srb <- cbind(sr,borda)[order(borda),] #bind borda to judges' ranks w <- kendall(sr,correct=TRUE) #determine coeff concordance tau <- cor(srb,method="kendall") #calculate tau matrix d <- as.dist((1-tau)/2) #calculate distances ca <- hclust(d,method="average") #determine cluster config mds <- cmdscale(d) #determine mds config x <- mds[,1] #extract x coord for mds y <- mds[,2] #extract y coord for mds plot(ca,ylab="distance") #plot hierarchical clusters plot (x,y,type="n",xlab="",ylab="",xlim=range(x)*1.2, ylim=range(y)*1.2) #set frame for mds map text(x,y,rownames(mds)) #add judge names to mds map