# NOT RUN {
data(cancer, package = "survival")
cancer$status <- cancer$status - 1
cancer <- cancer[, -1]
### With imputation included
res <- seMIsupcox(X = list(cancer), Y = cancer[, c("time", "status")],
Impute = TRUE, Impute.m = 3, center.init = TRUE,
nfolds = 10, center.init.N = 20)
### With imputation and center initialization not included
## 1 imputation
cancer.imp <- MImpute_surv(cancer, 3)
## 2 Center initialization
# A low N value is used for example purposes. Higher values should be used.
N <- 20
center.number <- sample(2:6, size = N, replace = TRUE)
the.seeds <- runif(N) * 10^9
sel.col <- which(!colnames(cancer) %in% c("time", "status"))
inits <- sapply(1:length(cancer.imp), function(mi.i) {
initiate_centers(data = cancer.imp[[mi.i]][, sel.col],
N = N, t = 1, k = center.number,
seeds.N = the.seeds)},
USE.NAMES = TRUE, simplify = FALSE)
## 3 learning
# }
# NOT RUN {
res1 <- seMIsupcox(X = cancer.imp, Y = cancer[, c("time", "status")],
Impute = FALSE, center.init = inits, nfolds = 10,
cleanup.partition = FALSE)
res2 <- seMIsupcox(X = cancer.imp, Y = cancer[, c("time", "status")],
center.init = inits, nfolds = 10)
# }
Run the code above in your browser using DataLab