CNB: CNB

Description Usage Arguments Details Value Examples

Description

Censored Naive Bayes

Usage

1
CNB(X, T, C, SURVTIME, X.test = NULL, scaleX = TRUE, type = "PC")

Arguments

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 T) over which predictions of the survival probability are desired. For instance, if SURVTIME equals t and X.test equals X, then the function estimates P(T ≥q t | X).

X.test

Matrix of predictors for which to obtain predictions.

scaleX

Logical indicating whether or not to standardize X and X.test so that each column has zero mean and unit variance. Default is TRUE.

type

Version of CNB to use. The default, type="PC", implements Censored Naive Bayes after applying a principal components decomposition to the predictor matrix. type="orig" uses the original predictor matrix.

Details

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

Value

A vector of predicted survival probabilities, with one entry corresponding to each row of X.test.

Examples

 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))

jwolfson/CNB documentation built on May 20, 2019, 6:26 a.m.