Optimal Recursive Shrinking of Tree Objects

DESCRIPTION:
Uses a particular parametrization of k that optimally shrinks lower nodes to their parent nodes based upon the magnitude of the difference between the fitted values of the lower nodes and the fitted values of their parent nodes.

USAGE:
shrink.tree(tree, k=(1:10)/(20:11), newdata)

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:
k:
shrinkage parameter (0<k<1) defining either a specific shrunken version of tree or, if length(k)>1, the sequence of shrunken trees obtained by optimal shrinking for each value of k. By default the sequence (1:10)/(20:11) (roughly .05 to .91) is used.
newdata:
a data frame containing the values at which predictions are required. The sequence of optimally shrunken trees is evaluated on newdata. If missing, the data used to grow the tree are used. The response as well as the predictors referred to in the right side of the formula in tree must be present by name in newdata. These data are dropped down each shrunken tree in the sequence and deviances calculated by comparing the supplied response to the prediction.

VALUE:
if k is supplied and is a scalar, a tree object is returned that has the same topology as the supplied tree but new values for the yval/yprob, dev, and n components of tree$frame.

Otherwise, an object of class tree.sequence is returned. The object contains the following components:

size:
number of (effective) terminal nodes in each tree in the optimal shrinkage sequence.
deviance:
total deviance of each tree in the optimal shrinkage sequence.
k:
the value of the shrinkage parameter of each tree in the sequence.

DETAILS:
A plot method exists for objects of class "tree.sequence". It displays the value of the deviance for each shrunken tree in the sequence. An additional axis displays the values of the shrinkage parameter for each tree.

SEE ALSO:
tree .

EXAMPLES:
z.auto <- tree(Mileage ~ Weight, car.test.frame)
zs <- shrink.tree(z.auto)     # determine the optimal shrinking sequence
plot(zs)
znew <- shrink.tree(z.auto, k=.4)
# select a specific shrunken tree in the sequence