#load test data
data(mdr1)
#split data into training and testing sets
train<-mdr1[1:125,]
test<-mdr1[-(1:125),]
#define matrix of all two-way combinations of 15 SNPs; this 105 by 2 matrix defines the 105 combinations of two-way interactions to consider
loci<-t(combn(15,2))
#this runs mdr on the training data, considering the two-way combinations in 'loci', saving the top model, and defining the threshold as 1 since the data is balanced
fit<-mdr(train,loci,x=1,ratio=1)
#estimate balanced accuracy given the MDR best model
acc<-mdr.hr(test,model=fit$models, hr=fit$high)
print(acc)
Run the code above in your browser using DataLab