Cost-complexity Pruning of an Rpart Object
Usage
prune.rpart(tree, cp)
Arguments
tree
|
fitted model object of class rpart. This is assumed to be the result
of some function that produces an object with the same named
components as that returned by the rpart function.
|
cp
|
Complexity parameter to which the rpart object will be trimmed.
|
Description
Determines a nested sequence of subtrees of the supplied rpart object
by recursively snipping off the least important splits, based on the
complexity parameter (cp).Value
A new rpart object that is trimmed to the value cp.See Also
rpartExamples
data(car.test.frame)
z.auto <- rpart(Mileage ~ Weight, car.test.frame)
zp <- prune.rpart(z.auto)
plot(zp) #plot smaller rpart object