crisk.pre.bart {BART}R Documentation

Data construction for competing risks with BART

Description

Competing risks contained in (t, \delta, x) must be translated to data suitable for the BART competing risks model; see crisk.bart for more details.

Usage

crisk.pre.bart( times, delta, x.train=NULL, x.test=NULL,
                x.train2=x.train, x.test2=x.test, K=NULL )

Arguments

times

The time of event or right-censoring.

delta

The event indicator: 1 is a cause 1 event, 2 a cause 2 while 0 is censored.

x.train

Explanatory variables for training (in sample) data of cause 1.
If provided, must be a matrix with (as usual) rows corresponding to observations and columns to variables.

x.test

Explanatory variables for test (out of sample) data of cause 1.
If provided, must be a matrix and have the same structure as x.train.

x.train2

Explanatory variables for training (in sample) data of cause 2.
If provided, must be a matrix with (as usual) rows corresponding to observations and columns to variables.

x.test2

Explanatory variables for test (out of sample) data of cause 2.
If provided, must be a matrix and have the same structure as x.train.

K

If provided, then coarsen times per the quantiles 1/K, 2/K, ..., K/K.

Value

surv.pre.bart returns a list. Besides the items listed below, the list has a times component giving the unique times and K which is the number of unique times.

y.train

A vector of binary responses for cause 1.

y.train2

A vector of binary responses for cause 2.

cond

A vector of indices of y.train indicating censored subjects.

binaryOffset

The binary offset for y.train.

binaryOffset2

The binary offset for y.train2.

tx.train

A matrix with rows consisting of time and the covariates of the training data for cause 1.

tx.train2

A matrix with rows consisting of time and the covariates of the training data for cause 2.

tx.test

A matrix with rows consisting of time and the covariates of the test data, if any, for cause 1.

tx.test2

A matrix with rows consisting of time and the covariates of the test data, if any, for cause 2.

See Also

crisk.bart

Examples


data(transplant)

delta <- (as.numeric(transplant$event)-1)

delta[delta==1] <- 4
delta[delta==2] <- 1
delta[delta>1] <- 2
table(delta, transplant$event)

table(1+floor(transplant$futime/30.5)) ## months
times <- 1+floor(transplant$futime/30.5)

typeO <- 1*(transplant$abo=='O')
typeA <- 1*(transplant$abo=='A')
typeB <- 1*(transplant$abo=='B')
typeAB <- 1*(transplant$abo=='AB')
table(typeA, typeO)

x.train <- cbind(typeO, typeA, typeB, typeAB)

N <- nrow(x.train)

x.test <- x.train

x.test[1:N, 1:4] <- matrix(c(1, 0, 0, 0), nrow=N, ncol=4, byrow=TRUE)

pre <- crisk.pre.bart(x.train=x.train, times=times, delta=delta, x.test=x.test)


[Package BART version 2.9.7 Index]