Description Usage Arguments Details Value Examples
Censored Naive Bayes
1 |
X |
Matrix of predictors for training the model. |
T |
Vector of observation times. |
C |
Vector of event indicators (1 = event, 0 = censored). |
SURVTIME |
Time horizon (on the same scale as the observation times in |
X.test |
Matrix of predictors for which to obtain predictions. |
scaleX |
Logical indicating whether or not to standardize |
type |
Version of CNB to use. The default, |
This function implements two versions of the Censored Naive Bayes technique as described in the technical report available at http://z.umn.edu/julianw-cnb
A vector of predicted survival probabilities, with one entry corresponding to each row of X.test
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(survival)
X <- flchain[,c("age","kappa","lambda")]
frac.train <- 0.7
ind.train <- sample.int(nrow(flchain),nrow(flchain)*0.7)
ind.test <- setdiff(1:nrow(flchain),ind.train)
X.train <- X[ind.train,]
X.test <- X[ind.test,]
T.train <- as.vector(flchain[ind.train,"futime"])
C.train <- as.vector(flchain[ind.train,"death"])
T.test <- as.vector(flchain[ind.test,"futime"])
C.test <- as.vector(flchain[ind.test,"death"])
SURVTIME <- 5000
survpreds.cnb <- CNB(X.train,T.train,C.train,5000,X.test=X.test)
eventpreds.cnb <- 1 - survpreds.cnb
cutpts <- c(0,0.1,0.2,0.3,1)
calib.table(list(eventpreds.cnb),T.test,C.test,cutpts,SURVTIME)
surv <- Surv(T.test,C.test)
survConcordance(surv ~ eventpreds.cnb)
## Compare concordance to a Cox Model
survConcordance(surv ~ predict(coxph(Surv(T.train,C.train)~age+kappa+lambda,data=X.train),X.test))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.