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 shaded square symbols at leaves and additional info at intermediate nodes.

Usage

  draw.tree (tree, ps=par("ps"), size=10, col=NULL, 
      nodeinfo=FALSE, units="units", cases="obs", digits=0)

Arguments

tree object of class "tree".
ps pointsize of text, par parameter.
size if size=0, draw terminal symbol at leaves else a colored square with sides of length size in mm.
col vector of colors from hsv, rgb etc, or if NULL, then generated as equally spaced hues, or if "gray", then generated as gray tones.
nodeinfo if TRUE, add a line at each node with mean value of response, number of observations, and percent deviance explained (or classified correct).
units label for units of mean value of response, if regression tree.
cases label for type of observations.
digits parameter for rounding mean value of response, if regression tree.

Details

Styled like S post.tree. As in plot.tree(,,type="u"), each level has constant depth. With nodeinfo=TRUE, deviance explained at each node, or classification rate, is shown in text format.

Value

The vector of colors supplied or generated.

Author(s)

Denis White, white.denis@epa.gov

See Also

draw.clust, map.groups

Examples

  library (tree)
  data (hex.env)

  draw.tree (prune.tree (tree (hex.env), best=6), 
      nodeinfo=TRUE, units="species", cases="cells")