draw.tree {maptree} | R Documentation |
Graph a Classification or Regression Tree
Description
Graph a classification or regression tree with a hierarchical tree diagram, optionally including colored symbols at leaves and additional info at intermediate nodes.
Usage
draw.tree (tree, cex=par("cex"), pch=par("pch"), size=2.5*cex,
col=NULL, nodeinfo=FALSE, units="", cases="obs",
digits=getOption("digits"), print.levels=TRUE,
new=TRUE)
Arguments
tree |
object of class |
cex |
size of text, par parameter. |
pch |
shape of symbol at leaves, par parameter. |
size |
if |
col |
vector of colors from |
nodeinfo |
if |
units |
label for units of mean value of response, if regression tree. |
cases |
label for type of observations. |
digits |
number of digits to round mean value of response, if regression tree. |
print.levels |
if |
new |
if |
Details
As in plot.rpart(,uniform=TRUE)
, each level has constant depth.
Specifying nodeinfo=TRUE
, shows the deviance explained or the
classification rate at each node.
A split is shown, for numerical variables, as
variable <> value
when the cases with lower values go left, or as
variable >< value
when the cases with lower values go right.
When the splitting variable is a factor, and print.levels=TRUE,
the split is shown as levels = factor = levels
with the cases
on the left having factor levels equal to those on the left of the
factor name, and correspondingly for the right.
Value
The vector of colors supplied or generated.
Author(s)
Denis White
See Also
Examples
library (rpart)
data (oregon.env.vars)
draw.tree (clip.rpart (rpart (oregon.env.vars), best=7),
nodeinfo=TRUE, units="species", cases="cells", digits=0)