Learn R Programming

itree (version 0.1)

prune.itree: Cost-complexity Pruning of an itree Object

Description

Determines a nested sequence of subtrees of the supplied itree object by recursively snipping off the least important splits, based on the complexity parameter (cp). Identical to prune.rpart.

Usage

prune(tree, ...)
"prune"(tree, cp, ...)

Arguments

tree
fitted model object of class itree. This is assumed to be the result of some function that produces an object with the same named components as that returned by the itree function.
cp
Complexity parameter to which the itree object will be trimmed.
...
further arguments passed to or from other methods.

Value

A new itree object that is trimmed to the value cp.

See Also

itree

Examples

Run this code
#the rpart example:
z.auto <- itree(Mileage ~ Weight, car.test.frame)
zp <- prune(z.auto, cp=0.1)
plot(zp) #plot smaller itree object

Run the code above in your browser using DataLab