Description Usage Arguments Details Author(s) References Examples
View source: R/extspace_testdat.R
space extension for test data
1 | extspace_testdat(testdata, ncombsub)
|
testdata |
test data |
ncombsub |
candidate variable for genereation |
space extension for test data
Hong Wang
Random Survival Forest with Space Extensions for Censored Data, submitted to Artificial Intelligence in Medicine
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (testdata, ncombsub)
{
testdata = model.matrix(~0 + ., as.data.frame(testdata))
d = dim(ncombsub)[2]
newx <- vector(mode = "list", length = d)
newx <- NULL
new_names <- paste("newvar", 1:d, sep = "_")
for (i in 1:d) {
newx = cbind(newx, testdata[, ncombsub[2, i]] - testdata[,
ncombsub[1, i]])
}
colnames(newx) <- new_names
newxdata = cbind(testdata, newx)
return(newxdata)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.