Plot a Low-Dimensional Tree Object

DESCRIPTION:

Displays a tree object as predictor versus fitted values. It is practical for at most two predictor variables.

USAGE:

partition.tree(tree, label = "yval", add = F, ordinate = var[2], ...) 

REQUIRED ARGUMENTS:

tree
fitted model object of class tree. This is assumed to be the result of some function that produces an object with the same named components as that returned by the tree() function.

OPTIONAL ARGUMENTS:

label
label for the partitions. By default, the fitted value of the response variable is used to label each partition of the tree. For classification trees, the supplied label must be a column name of tree$yprob.
add
logical; if TRUE, the partition or step function is added to the current plot.
ordinate
character string that specifies which variable is plotted on the ordinate axis. Default is the name of the second variable.
...
other arguments to be passed to the plot function.

SIDE EFFECTS:

a plot of the relationship y = f(x) (one-variable tree) or y = f(x1, x2) (two-variable tree). The function stops if tree consists of more than two predictors or if the predictors are factors.

DETAILS:

For a single predictor, y=f(x) is a step function. For two predictors, the prediction space is carved into partitions, displaying the fitted values in each.

SEE ALSO:

.

EXAMPLES:

z <- tree(Mileage ~ Weight, car.test.frame) 
partition.tree(z) 
Weight <- car.test.frame$Weight 
Mileage <- car.test.frame$Mileage 
points(Weight, Mileage)