#simulate a dataset with binary data
dataset <- matrix(rbinom(100 * 101, 1, 0.6), ncol = 101)
#initialize binary target
target <- dataset[, 101]
#remove target from the dataset
dataset <- dataset[, -101]
#run the gSquare conditional independence test for the binary class variable
results <- gSquare(target, dataset, xIndex = 44, csIndex = c(10,20) )
results
#require(gRbase) #for faster computations in the internal functions
#run SES algorithm using the gSquare conditional independence test for the binary class variable
sesObject <- SES(target, dataset, max_k = 3, threshold = 0.05, test = "gSquare");
target <- as.factor(target)
sesObject2 <- SES(target, dataset, max_k = 3, threshold = 0.05, test = "testIndLogistic");
#print summary of the SES output
summary(sesObject);
summary(sesObject2);
#plot the SES output
plot(sesObject, mode = "all");
Run the code above in your browser using DataLab