Learn R Programming

DStree (version 1.0)

bag: Bagging Discrete-Time Survival Trees

Description

Function for bagging discrete-time survival trees.

Usage

bag(formula, data, status, nBoot = 10, minbucket = 40)

Arguments

formula
a formula with a response but no interaction terms. The response variable represents the observed survival times.
status
integer/string representing the column number/name of the 'status' variable in the data frame. 'status' must be a binary integer variable indicating whether the event occured (=1) or whether the event was censored/did not occur (=0).
data
data frame that contains all variables stated in the formula argument, as well as the status variable.
nBoot
an integer referring to the number of bootstrap replications.
minbucket
the minimum number of observations in any terminal node.

Value

The bag function returns an object of class 'DStreebag' which is a list containing the following objects:The vector MedSurv contains the predicted, averaged median survival times. The matrices Surv and Haz contain the predicted, averaged probabilities and hazard rates, respectively, where each row refers to an individual and each column refers to an observed time point (1,2,...). The list element 'trees' contains the nBoot unpruned trees of class 'DStree'. The list elements 'minbucket' and 'nboot' have the same meaning as above.

Details

The bag function grows nBoot unpruned trees from bootstrap samples. For each fitted tree the median survival time, as well as the predicted survival probabilities and hazard rates of the individuals in data are returned.

References

Bou-Hamad I., Larocque D., Ben-Ameur H., Masse L. C., Vitaro F. and Tremblay R. E. (2009), Discrete-Time Survival Trees. Canadian Journal of Statistics 37 (1), 17-32.

Hothorn T., Lausen B., Benner A. and Radespiel-Troeger M. (2004), Bagging Survival Trees. Statistics in Medicine 23 (1), 77-91.

Examples

Run this code
data(cost)
## Discretize observed days to years
d.cost <- dis.cost(cost)# Bagging Tree
pred <- bag(time~prevStroke+age+sex+alcohol+smoke,status="status",data=d.cost,nBoot=50)

# Predicted, averaged probabilities and median survival times for each individual
pred$MedSurv
pred$Surv
pred$Haz

Run the code above in your browser using DataLab