Learn R Programming

partykit (version 0.1-1)

panelfunctions: Panel-Generators for Visualization of Party Trees

Description

The plot method for party and constparty objects are rather flexible and can be extended by panel functions. Some pre-defined panel-generating functions of class grapcon_generator for the most important cases are documented here.

Usage

node_inner(obj, id = TRUE, abbreviate = FALSE, fill = "white", 
    gp = gpar())
node_terminal(obj, digits = 3, abbreviate = FALSE,
    fill = c("lightgray", "white"), id = TRUE, gp = gpar())
edge_simple(obj, digits = 3, abbreviate = FALSE)
node_boxplot(obj, col = "black", fill = "lightgray", width = 0.5,
    yscale = NULL, ylines = 3, cex = 0.5, id = TRUE, gp = gpar())
node_barplot(obj, col = "black", fill = NULL, beside = NULL,
    ymax = NULL, ylines = NULL, widths = 1, gap = NULL,
    reverse = NULL, id = TRUE, gp = gpar())

Arguments

obj
an object of class party.
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
logical. Should node IDs be plotted?
ylines
number of lines for spaces 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
ymax
upper limit in y-direction
cex
character extension of points in scatter plots.
beside
logical indicating if barplots should be side by side or stacked.
reverse
logical indicating whether the order of levels should be reversed for barplots.
gp
graphical parameters.
...
additional arguments passed to callies.

Details

The plot methods for party and constparty objects provide 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. The panel functions to be used should depend only on the node being visualized, however, for setting up an appropriate panel function, information from the whole tree is typically required. Hence, party adopts the framework of grapcon_generator (graphical appearance control) from the vcd package (Meyer, Zeileis and Hornik, 2005) and provides several panel-generating functions. 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 node_terminal is a terse text-based representation of terminal nodes.

Graphical representations of terminal nodes are available and depend on the kind of model and the measurement scale of the variables modeled.

For univariate regressions (typically fitted by ), 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 bar plots, box plots, histograms and estimated densities into the terminal nodes.

For multivariate regressions (typically fitted by mob), node_bivplot returns a panel function that creates bivariate plots of the response against all regressors in the model. Depending on the scale of the variables involved, scatter plots, box plots, spinograms (or CD plots) and spine plots are created. For the latter two spine and cd_plot from the vcd package are re-used.

References

David Meyer, Achim Zeileis, and Kurt Hornik (2006). The Strucplot Framework: Visualizing Multi-Way Contingency Tables with vcd. Journal of Statistical Software, 17(3). http://www.jstatsoft.org/v17/i03/