surv.pre.bart: Data construction for nonparametric survival analysis with...

Description Usage Arguments Value Author(s) References See Also Examples

Description

Survival data contained in (t,δ, x) must be translated to data suitable for the BART survival analysis model; see surv.bart for more details.

Usage

1
surv.pre.bart( times, delta, x.train=NULL, x.test=NULL )

Arguments

times

The time of event or right-censoring.

delta

The event indicator: 1 is an event while 0 is censored.

x.train

Explanatory variables for training (in sample) data.
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.
If provided, must be a matrix and have the same structure as x.train.

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.

X.train

A matrix with the rows of the training data.

X.test

A matrix with the rows of the test data, if any.

Author(s)

Rodney Sparapani: [email protected]

References

Sparapani, R., Logan, B., McCulloch, R., and Laud, P. (2016) Nonparametric survival analysis using Bayesian Additive Regression Trees (BART). Statistics in Medicine, in press.

See Also

surv.bart

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Not run: 
require(survbart)

## load survival package for the advanced lung cancer example
require(survival)

group <- -which(is.na(lung[ , 7])) ## remove missing row for ph.karno
times <- lung[group, 2]   ##lung$time
delta <- lung[group, 3]-1 ##lung$status: 1=censored, 2=dead
                          ##delta: 0=censored, 1=dead

summary(times)
table(delta)

x.train <- as.matrix(lung[group, c(4, 5, 7)]) ## matrix of observed covariates
## lung$age:        Age in years
## lung$sex:        Male=1 Female=2
## lung$ph.karno:   Karnofsky performance score (dead=0:normal=100:by=10)
##                  rated by physician

dimnames(x.train)[[2]] <- c('age(yr)', 'M(1):F(2)', 'ph.karno(0:100:10)')

summary(x.train[ , 1])
table(x.train[ , 2])
table(x.train[ , 3])

x.test <- matrix(nrow=84, ncol=3) ## matrix of covariate scenarios

dimnames(x.test)[[2]] <- dimnames(x.train)[[2]]

i <- 1

for(age in 5*(9:15)) for(sex in 1:2) for(ph.karno in 10*(5:10)) {
    x.test[i, ] <- c(age, sex, ph.karno)
    i <- i+1
}

data.constructed <- surv.pre.bart(times=times, delta=delta, x.train=x.train, x.test=x.test)

## End(Not run)

survbart documentation built on May 2, 2019, 5:47 p.m.