MBA protocol
#version information: v0.2 #date of update: 28/Dec/2017 #To perform MBA, please prepare binary data (0/1 data) matrix first # An example of dataset prepared for MBA # sample No. | variable 1 | variable 2 | variable 3 | ... # 1 | 0 | 0 | 1 | ... # 2 | 1 | 0 | 0 | ... # 3 | 1 | 1 | 0 | ... # ... | ... | ... | ... | ... #In this case, you have to delete the first column (sample No.) for the analyses (see below). library(arules) #"arules" is the name of R package used for analyses data_pre<-read.csv("filename.csv") #"filename" is the name of prepared csv file data_tran<-as(as.matrix(data_pre[2:ncol(data_pre)]),"transactions") #convert to transaction data and omit the first column ap<-apriori(data_tran,p=list(support=0.0625,confidence=0.25,maxlen=2)) #calculation of association rules #In our dataset reported in the paper, cutoff values of support and confidence are set to 0.0625 and 0.25, respectively rule<-ap[quality(ap)$lift>1.2] #cutoff value of lift was set to 1.2 in this paper write(rule, "filename.txt") # Output rules. "filename" is the name of output data which you can give it the way you want.