Description Usage Arguments Details References Examples
View source: R/plot_coxphtree.R
This functin uses the full tree and subtrees (optional) to create visual outputs of the tree(s) and segments.
1 | plot_coxphtree(fulltree, subtrees = NULL, mm = 3, start = 0, pdf = FALSE, file.name)
|
fulltree |
output of |
subtrees |
(Optional) output of |
mm |
Number of subtrees plot to be placed in one page. Default is 3 |
start |
Sets starting point for segments. Useful if the minimum event time is far away from 0. |
pdf |
Do you want to export the plots in pdf format? Default is FALSE. When set as FALSE, all plots need to be cleared before running this function to avoid 'Plot rendering error.' |
file.name |
Name for the pdf file output. |
plot_coxphtree
takes an output from output.coxphout
and creates treeplot and barplot showing blocks at each depth.
If an output from prune
is also included in the argument, the function creates treeplot and barplot for each subtree.
In the barplot, end nodes are in dark blue color.
Xu, R. and Adak, S. (2002), Survival Analysis with Time-Varying Regression Effects Using a Tree-Based Approach. Biometrics, 58: 305-315.
1 2 3 4 5 6 7 8 9 10 11 | #This function requires output from output.coxphout and prune(optional)
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)
plot_coxphtree(nodetree, subtrees, start = 70, pdf = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.