Visualization of Binary Regression Trees
Description
plot
method for BinaryTree
objects with
extended facilities for plugging in panel functions.
Usage
1 2 3 4 5 6 7 8  ## S3 method for class 'BinaryTree'
plot(x, main = NULL, type = c("extended", "simple"),
terminal_panel = NULL, tp_args = list(),
inner_panel = node_inner, ip_args = list(),
edge_panel = edge_simple, ep_args = list(),
drop_terminal = (type[1] == "extended"),
tnex = (type[1] == "extended") + 1, newpage = TRUE,
pop = TRUE, ...)

Arguments
x 
an object of class 
main 
an optional title for the plot. 
type 
a character specifying the complexity of the plot:

terminal_panel 
an optional panel function of the form

tp_args 
a list of arguments passed to 
inner_panel 
an optional panel function of the form

ip_args 
a list of arguments passed to 
edge_panel 
an optional panel function of the form

ep_args 
a list of arguments passed to 
drop_terminal 
a logical indicating whether all terminal nodes should be plotted at the bottom. 
tnex 
a numeric value giving the terminal node extension in relation to the inner nodes. 
newpage 
a logical indicating whether 
pop 
a logical whether the viewport tree should be popped before return. 
... 
additional arguments passed to callies. 
Details
This plot
method for BinaryTree
objects provides an
extensible framework for the visualization of binary regression trees. The
user is allowed to specify panel functions for plotting terminal and inner
nodes as well as the corresponding edges. Panel functions for plotting
inner nodes, edges and terminal nodes are available for the most important
cases and can serve as the basis for usersupplied extensions, see
node_inner
and vignette("party")
.
More details on the ideas and concepts of panelgenerating functions and
"grapcon_generator"
objects in general can be found in Meyer, Zeileis
and Hornik (2005).
References
David Meyer, Achim Zeileis, and Kurt Hornik (2006). The Strucplot Framework: Visualizing MultiWay Contingency Tables with vcd. Journal of Statistical Software, 17(3). http://www.jstatsoft.org/v17/i03/
See Also
node_inner
, node_terminal
, edge_simple
,
node_surv
, node_barplot
, node_boxplot
,
node_hist
, node_density
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  set.seed(290875)
airq < subset(airquality, !is.na(Ozone))
airct < ctree(Ozone ~ ., data = airq)
### regression: boxplots in each node
plot(airct, terminal_panel = node_boxplot, drop_terminal = TRUE)
if(require("TH.data")) {
## classification: barplots in each node
data("GlaucomaM", package = "TH.data")
glauct < ctree(Class ~ ., data = GlaucomaM)
plot(glauct)
plot(glauct, inner_panel = node_barplot,
edge_panel = function(ctreeobj, ...) { function(...) invisible() },
tnex = 1)
## survival: KaplanMeier curves in each node
data("GBSG2", package = "TH.data")
library("survival")
gbsg2ct < ctree(Surv(time, cens) ~ ., data = GBSG2)
plot(gbsg2ct)
plot(gbsg2ct, type = "simple")
}

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.