if (FALSE) {
data(burn)
myarg = list(cp = 0, maxcompete = 0, maxsurrogate = 0, maxdepth = 2)
Y.names = c("T3" ,"D3")
P.names = 'Z2'
T.names = c("Z1", paste("Z", 3:11, sep = ''))
mybag = 40
feat_samp = length(T.names)
set.seed(5000)
## fit an improper survival tree
burn.tree <- suppressWarnings(improper_tree(burn,
Y.names,
P.names,
T.names,
method = "R2",
args.rpart = myarg))
plot(burn.tree)
text(burn.tree, cex = .7, xpd = TRUE)
## fit an improper Bagging survival tree with the adjusted Logrank criterion
burn.BagEssai0 <- suppressWarnings(Bagg_Surv(burn,
Y.names,
P.names,
T.names,
method = "LR",
args.rpart = myarg,
args.parallel = list(numWorkers = 1),
Bag = mybag, feat = feat_samp))
## fit an improper Bagging survival tree with the pseudo R2 criterion
burn.BagEssai1 <- suppressWarnings(Bagg_Surv(burn,
Y.names,
P.names,
T.names,
method = "R2",
args.rpart = myarg,
args.parallel = list(numWorkers = 1),
Bag = mybag, feat = feat_samp))
## Plot the variable importance scores
par(mfrow=c(1,3))
barplot(burn.BagEssai1$IIS,
main = 'IIS',
horiz = TRUE,
las = 1,
cex.names = .8,
col = 'lightblue')
barplot(burn.BagEssai1$DIIS,
main = 'DIIS',
horiz = TRUE,
las = 1,
cex.names = .8,
col = 'grey')
barplot(burn.BagEssai1$DEPTH,
main = 'MinDepth',
horiz = TRUE,
las = 1,
cex.names = .8,
col = 'purple')
## evaluation of the Bagging predictors
pred0 <- suppressWarnings(Bagg_pred_Surv(burn,
Y.names,
P.names,
burn.BagEssai0,
args.parallel = list(numWorkers = 1),
OOB = TRUE))
pred1 <- suppressWarnings(Bagg_pred_Surv(burn,
Y.names,
P.names,
burn.BagEssai1,
args.parallel = list(numWorkers = 1),
OOB = TRUE))
}
Run the code above in your browser using DataLab