Panel Generating Functions {party} | R Documentation |
The plot method for BinaryTree
objects is rather flexible and can
be extended by panel functions. Some pre-defined panel generating
functions for the most important cases are documented here.
node_inner(ctreeobj, digits = 3, abbreviate = FALSE, fill = "white", id = TRUE) node_terminal(ctreeobj, digits = 3, abbreviate = FALSE, fill = c("lightgray", "white"), id = TRUE) edge_simple(ctreeobj, digits = 3, abbreviate = FALSE) node_surv(ctreeobj, ylines = 2, id = TRUE, ...) node_barplot(ctreeobj, col = "black", fill = "lightgray", ymax = NULL, ylines = 3, widths = 1, gap = NULL, id = TRUE) node_boxplot(ctreeobj, col = "black", fill = "lightgray", width = 0.5, yscale = NULL, ylines = 3, id = TRUE) node_hist(ctreeobj, col = "black", fill = "lightgray", freq = FALSE, horizontal = TRUE, xscale = NULL, ymax = NULL, ylines = 3, id = TRUE, ...) node_density(ctreeobj, col = "black", rug = TRUE, horizontal = TRUE, xscale = NULL, yscale = NULL, ylines = 3, id = TRUE)
ctreeobj |
an object of class BinaryTree . |
digits |
integer, used for formating numbers. |
abbreviate |
logical indicating whether strings should be abbreviated. |
col |
a color for points and lines. |
fill |
a color to filling rectangles. |
id |
a logical indicating whether the node ID should be plotted. |
ylines |
number of lines in y-direction. |
widths |
widths in barplots. |
width |
width in boxplots. |
gap |
gap between bars in a barplot (node_barplot ). |
yscale |
limits in y-direction |
xscale |
limits in x-direction |
ymax |
upper limit in y-direction |
horizontal |
logical indicating if the plots should be horizontal. |
freq |
logical; if TRUE , the histogram graphic is a representation
of frequencies. If FALSE , probabilities are plotted. |
rug |
logical indicating if a rug representation should be added. |
... |
additional arguments passed to callies. |
The 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. For convenience, the panel
generating functions node_inner
and edge_simple
return panel functions to draw inner nodes and left and right edges.
For drawing terminal nodes, the functions returned by the other panel
functions can be used. The panel generating function panel_terminal_node
is a terse text-based representation of terminal nodes.
Graphical representations of terminal nodes are available and depend on
the measurement scale of the response variable the tree was fitted to.
node_surv
returns a functions that plots Kaplan-Meier curves in each
terminal node. node_barplot
, node_boxplot
, node_hist
and
node_density
can be used to plot barplots, boxplots, histograms and
estimated densities into the terminal nodes.
data(airquality) airq <- subset(airquality, !is.na(Ozone)) airct <- ctree(Ozone ~ ., data = airq) ### very simple; the mean is given in each terminal node plot(airct, type = "simple") ### density estimates plot(airct, terminal_panel = node_density) ### histograms plot(airct, terminal_panel = node_hist) ### boxplots plot(airct, terminal_panel = node_boxplot, drop_terminal = TRUE)