bag(formula, data, status, nBoot = 10, minbucket = 40)
=1
) or whether the event was censored/did not
occur (=0
).formula
argument, as well as the
status
variable.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.
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.
Hothorn T., Lausen B., Benner A. and Radespiel-Troeger M. (2004), Bagging Survival Trees. Statistics in Medicine 23 (1), 77-91.
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