#create a survival simulated dataset
dataset <- matrix(runif(1000 * 100, 1, 100), nrow = 1000 , ncol = 100)
dataset <- as.data.frame(dataset);
timeToEvent <- numeric(1000)
event <- numeric(1000)
ca <- numeric(1000)
for(i in 1:1000) {
timeToEvent[i] <- dataset[i, 1] + 0.5*dataset[i, 30] + 2*dataset[i, 65] + runif(1, 0, 1);
event[i] <- sample( c(0, 1), 1)
ca[i] <- runif(1, 0, timeToEvent[i]-0.5)
if(event[i] == 0) {
timeToEvent[i] = timeToEvent[i] - ca[i]
}
}
require(survival, quietly = TRUE)
#init the Surv object class feature
target <- Surv(time = timeToEvent, event = event)
#run the censIndCR conditional independence test
res <- censIndCR( target, dataset, xIndex = 12, csIndex = c(35, 7, 4) )
res
#run the SES algorithm using the censIndCR conditional independence
#test for the survival class variable
sesObject <- SES(target, dataset, max_k = 1, threshold = 0.05, test = "censIndCR");
sesObject2 <- SES(target, dataset, max_k = 1, threshold = 0.05, test = "censIndWR");
#print summary of the SES output
summary(sesObject);
Run the code above in your browser using DataLab