getcp: Complexity Parameter table for partition models

Description Usage Arguments Details Author(s) References See Also Examples

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

1
getcp(TREE)

Arguments

TREE

An object of class rpart. This is created by making a partition model using rpart.

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

rpart

Examples

1
2
3
4
  data(JUNK)
	TREE <- rpart(Junk~.,data=JUNK,control=rpart.control(cp=0,xval=10,minbucket=5))
	getcp(TREE)
	 

profpetrie/regclass documentation built on May 26, 2019, 8:33 a.m.