Learn R Programming

TimeVTree (version 0.3.1)

final.tree: Finding the Final Tree After Bootstrap

Description

final.tree uses bias-corrected costs obtained from bootstrap function and the predetermined penalty parameter to find the optimal tree from the set of subtrees.

Usage

final.tree(nodetree=nodetree, subtrees=subtrees, omega, alphac=2)

Arguments

nodetree

Fully grown tree from the original data. Output from output.coxphout

subtrees

Pruned subtrees from the original data. Output from prune

omega

Bias (i.e. third index of the output) from bootstrap. Look at the value section of bootstrap for more information.

alphac

Predetermined penalty parameter

Value

subtree

output from prune with an additional column 'cost' that contains bootstrap estimate of each subtree

final

A tree with lowest cost value after applying predetermined penalty

Details

final.tree is part of the bootstrap function but can be used to try different penalty parameters without re-running bootstrap.

References

Xu, R. and Adak, S. (2002), Survival Analysis with Time-Varying Regression Effects Using a Tree-Based Approach. Biometrics, 58: 305-315.

Examples

Run this code
# NOT RUN {
data('alcohol')
require(survival)

coxtree <- coxph.tree(alcohol[,'time'], alcohol[,'event'], 
                      x = alcohol[,'alc', drop = FALSE], D = 4)
nodetree <- output.coxphout(coxtree)

subtrees <- prune(nodetree)

store.mult.cont <- bootstrap(B=20, nodetree, subtrees, alcohol[,'time'],
                                alcohol[,'event'], x = alcohol[,'alc', drop = FALSE], 
                                D=4,minfail=20, alphac=2)
                                
Balph <- 0.5 * 2 * log(nrow(alcohol))                                
final.tree <- final.tree(nodetree, subtrees, store.mult.cont[[3]], alphac= Balph)
# }

Run the code above in your browser using DataLab