How do I go about selecting the ideal location to use for pruning the tree here?

Or maybe someone can explain to me in simple language what this output means. I see that rel_error is constantly decreasing when I run this but x_error decreases until the 3rd point at .48 before rising again.

Which point do I use to pick the best length for the tree?

 z=rpart(crim~., data = Boston, method="anova", xval=10, cp=.0005)

http://cran.r-project.org/web/packages/rpart/rpart.pdf plotcp() details: "The set of possible cost-complexity prunings of a tree from a nested set. For the geometric means of the intervals of values of cp for which a pruning is optimal, a cross-validation has (usually) been done in the initial construction by rpart. The cptable in the fit contains the mean and standard deviation of the errors in the cross-validated prediction against each of the geometric means, and these are plotted by this function. A good choice of cp for pruning is often the leftmost value for which the mean lies below the horizontal line." PS library(rpart)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.