plot.stabletree | R Documentation |
Visualizations of tree stability assessments carried out
via stabletree
.
## S3 method for class '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,
original = TRUE, ...)
## S3 method for class '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,
original = TRUE, ...)
## S3 method for class '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),
original = TRUE, ...)
x, height |
an object of class |
original |
logical. Should the original tree information be highlighted? |
select |
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 |
type.breaks |
A character specifying the type of information added to
the lines that represent the splits in the complete data tree.
|
col.breaks |
Coloring of the lines and the texts that represent the splits in the complete data tree. |
lty.breaks |
Type of the lines that represent the splits in the complete data tree. |
cex.breaks |
Size of the texts that represent the splits in the complete data tree. |
col.main |
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. |
main.uline |
A logical value. If |
args.numeric |
A list of arguments passed to the internal function
that is used for plotting a histogram of the cutpoints in numerical splits.
|
args.factor |
A list of arguments passed to the internal function that
is used for plotting an image plot of the cutpoints in categorical splits.
|
args.ordered |
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
|
... |
further arguments passed to plotting functions, especially for labeling and annotation. |
main, xlab, ylab |
character. Annotations of axes and main title, respectively. |
horiz |
A logical value. If |
col |
A vector of colors of length two used for coloring in the
|
names.arg |
A vector of labels to be plotted below each bar (in case of
|
names.uline |
A logical value. If |
names.diag |
A logical value (omitted if |
cex.names |
Expansion factor for labels. |
xlim, ylim |
The limits of the plot. |
xaxs, yaxs |
The style of axis interval calculation to be used (see
|
col.tree, lty.tree |
color and line type to indicate differences from the original tree that was resampled. |
plot
visualizes the variability of the cutpoints.
barplot
visualizes the variable selection frequency.
image
visualizes the combinations of variables selected.
stabletree
## 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"))
## 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.breaks = "levels")
plot(s, select = 3, type.breaks = "nodeids")
plot(s, select = 3, type.breaks = "breaks")
plot(s, select = 3, type.breaks = "none")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.