Last chance! 50% off unlimited learning
Sale ends in
censIndLR(target, dataset, xIndex, csIndex, dataInfo = NULL, univariateModels = NULL,
hash = FALSE, stat_hash = NULL, pvalue_hash = NULL, robust = FALSE)
SES, testIndFisher, gSquare, testIndLogistic, Surv, coxph, anova, CondIndTests
#create a survival simulated dataset
dataset <- matrix(nrow = 1000 , ncol = 100)
dataset <- apply(dataset, 1:2, function(i) runif(1, 1, 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)
#init the Surv object class feature
if(require(survival, quietly = TRUE)) {
target <- Surv(time = timeToEvent, event = event)
#run the censIndLR conditional independence test
res <- censIndLR( target, dataset, xIndex = 12, csIndex = c(35, 7, 4) )
res
#run the SES algorithm using the censIndLR conditional independence
#test for the survival class variable
#require(gRbase) #for faster computations in the internal functions
sesObject <- SES(target, dataset, max_k = 1, threshold = 0.05, test = "censIndLR");
#print summary of the SES output
summary(sesObject);
#plot the SES output
plot(sesObject, mode = "all");
}
Run the code above in your browser using DataLab