plot_coxphtree: Plotting of Full Tree and Subtrees

Description Usage Arguments Details References Examples

View source: R/plot_coxphtree.R

Description

This functin uses the full tree and subtrees (optional) to create visual outputs of the tree(s) and segments.

Usage

1
plot_coxphtree(fulltree, subtrees = NULL, mm = 3, start = 0, pdf = FALSE, file.name)

Arguments

fulltree

output of output.coxphout.

subtrees

(Optional) output of prune.

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.

Details

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.

References

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

Examples

 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)

TimeVTree documentation built on May 2, 2019, 2:17 a.m.