Reorder Terminal Nodes of a Binary Tree.

DESCRIPTION:

Takes a fitted tree object and returns an object with the terminal nodes reordered according to the increasing values of x.

USAGE:

order.tree(tree, x) 

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.
x
variable to reorder.

VALUE:

Tree object similar to tree but with the terminal nodes reordered according to increasing values of x. Exact (global) reordering is not generally possible; local reordering is such that at each internal (parent) node, the mean of x at the left-sibling node is less than that of it's right-sibling. The statistical properties of the tree remain unchanged (eg. predictions/ goodness-of-fit). [The physical concept is that a binary tree is actually a mobile in 3-D; order.tree() merely provides alternative rotations of the mobile components.]

SEE ALSO:

.

EXAMPLES:

z.cu <- tree(cu.summary) 
# reorder nodes so that leftmost nodes contain inexpensive cars 
# and rightmost nodes the expensive cars 
newz.cu <- order.tree(z.cu, Price)