
Last chance! 50% off unlimited learning
Sale ends in
Visualizations of tree stability assessments carried out
via stabletree
.
# S3 method for stabletree
plot(x, select = order(colMeans(x$vs), decreasing = TRUE),
type.breaks = "levels", col.breaks = "red", lty.breaks = "dashed",
cex.breaks = 0.7, col.main = c("black", "gray50"), main.uline = TRUE,
args.numeric = NULL, args.factor = NULL, args.ordered = NULL, main = NULL,
…)# S3 method for stabletree
barplot(height, main = "Variable selection frequencies",
xlab = "", ylab = "", horiz = FALSE, col = gray.colors(2),
names.arg = NULL, names.uline = TRUE, names.diag = TRUE,
cex.names = 0.9,
ylim = if (horiz) NULL else c(0, 100), xlim = if (horiz) c(0, 100) else NULL,
…)
# S3 method for stabletree
image(x, main = "Variable selections",
ylab = "Repetitions", xlab = "", col = gray.colors(2),
names.arg = NULL, names.uline = TRUE, names.diag = TRUE,
cex.names = 0.9, xaxs = "i", yaxs = "i",
col.tree = 2, lty.tree = 2, xlim = c(0, length(x$vs0)), ylim = c(0, x$B),
…)
an object of class stabletree
.
An vector of integer or character values representing the
number(s) or the name(s) of the variable(s) to be plotted. By default all
variables are plotted. The numbers correspond to the ordering of all
partitioning variables used in the call of the fitted model object that was
passed to stabletree
.
A character specifying the type of information added to
the lines that represent the splits in the complete data tree.
type.breaks = "levels"
adds the level of the splits.
type.breaks = "nodeids"
adds the nodeid of the splits.
type.breaks = "breaks"
adds the cutpoint of the splits.
type.breaks = "none"
suppresses any labelling.
Coloring of the lines and the texts that represent the splits in the complete data tree.
Type of the lines that represent the splits in the complete data tree.
Size of the texts that represent the splits in the complete data tree.
A vector of colors of length two. The first color is used for titles of variables that are selected in the complete data tree. The second color is used for titles of variables that are not selected in the complete data tree.
A logical value. If TRUE
, variables selected in the
complete data tree are underlined. If FALSE
, underlining is
surpressed.
A list of arguments passed to the internal function
that is used for plotting a histogram of the cutpoints in numerical splits.
breaks
is passed to hist
(see hist
for details).
Further arguments in the list are passed to plot.histogram
such
as col
, border
etc.
A list of arguments passed to the internal function that
is used for plotting an image plot of the cutpoints in categorical splits.
col
(a vector of two colors) is used to illustrate
categorical splits. Please note that the default colors are optimized for
color vision deficiency. col.na
defines the color used to highlight
missing categories. Further arguments in the list are passed to the function
plot.default
.
A list of arguments passed to the internal function that
is used for plotting a barplot of the cutpoints in ordered categorical splits.
All arguments in the list are passed to the function
barplot.default
, such as col
, border
etc.
further arguments passed to plotting functions, especially for labeling and annotation.
character. Annotations of axes and main title, respectively.
A logical value. If FALSE
, the bars are drawn vertically
with the first bar to the left. If TRUE
, bars are drawn horizontally
with the first at the bottom.
A vector of colors of length two used for coloring in the
barplot
and image
methods. The first color represents selected
and the second color represents not selected partitioning variables.
A vector of labels to be plotted below each bar (in case of
barplot
) or each column (in case of image
). If the argument is omitted, then
the variable names are taken as labels.
A logical value. If TRUE
, the labels representing
variables that are used for splitting in the complete data tree, are
underlined. If FALSE
, labels are not underlined.
A logical value (omitted if horiz = TRUE
). If
TRUE
, the labels are drawn diagonally. If FALSE
, labels are
drawn horizontally.
Expansion factor for labels.
The limits of the plot.
The style of axis interval calculation to be used (see
par
for details).
FIXME
FIXME
# NOT RUN {
# }
# NOT RUN {
## build a tree
library("partykit")
m <- ctree(Species ~ ., data = iris)
plot(m)
## investigate stability
set.seed(0)
s <- stabletree(m, B = 500)
## show variable selection proportions
## with different labels and different ordering
barplot(s)
barplot(s, cex.names = 0.8)
barplot(s, names.diag = FALSE)
barplot(s, names.arg = c("a", "b", "c", "d"))
barplot(s, names.uline = FALSE)
barplot(s, col = c("lightgreen", "darkred"))
barplot(s, horiz = TRUE)
## illustrate variable selections of replications
## with different labels and different ordering
image(s)
image(s, cex.names = 0.8)
image(s, names.diag = FALSE)
image(s, names.arg = c("a", "b", "c", "d"))
image(s, names.uline = FALSE)
image(s, col = c("lightgreen", "darkred"))
image(s, order.row = FALSE)
image(s, order.col = FALSE)
## graphical cutpoint analysis, selecting variable by number and name
## with different numerical of break points
plot(s)
plot(s, select = 3)
plot(s, select = "Petal.Width")
plot(s, args.numeric = list(breaks = 40))
# change labels of splits in complete data tree
plot(s, select = 3, type.labels = "levels")
plot(s, select = 3, type.labels = "nodeids")
plot(s, select = 3, type.labels = "breaks")
plot(s, select = 3, type.labels = "none")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab