getcp {regclass} | R Documentation |
Complexity Parameter table for partition models
Description
A simple function to take the output of a partition model created with rpart
and return information abouthe complexity parameter and performance of varies models.
Usage
getcp(TREE)
Arguments
TREE |
An object of class |
Details
This function prints out a table of the complexity parameter, number of splits, relative error, cross validation error, and standard deviation of cross validation error for a partition model. It adds helpful advice for what the value of CP is for the tree that had the lowest cross validation error and also the value of CP for the simplest tree with a cross validation error at most 1 standard deviation above the lowest.
Further, a plot is made of the estimated generalization error (xerror
) versus the number of splits to illustrate when the tree stops improving. Vertical lines are draw at the number of splits corresponding to the lowest estimated generalization error to the tree selected by the one standard deviation rule.
Author(s)
Adam Petrie
References
Introduction to Regression and Modeling
See Also
Examples
data(JUNK)
TREE <- rpart(Junk~.,data=JUNK,control=rpart.control(cp=0,xval=10,minbucket=5))
getcp(TREE)