Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotcp

Plot a Complexity Parameter Table for an Rpart Fit


Description

Gives a visual representation of the cross-validation results in an rpart object.

Usage

plotcp(x, minline = TRUE, lty = 3, col = 1,
       upper = c("size", "splits", "none"), ...)

Arguments

x

an object of class "rpart"

minline

whether a horizontal line is drawn 1SE above the minimum of the curve.

lty

line type for this line

col

colour for this line

upper

what is plotted on the top axis: the size of the tree (the number of leaves), the number of splits or nothing.

...

additional plotting parameters

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.

Value

None.

Side Effects

A plot is produced on the current graphical device.

See Also


rpart

Recursive Partitioning and Regression Trees

v4.1-15
GPL-2 | GPL-3
Authors
Terry Therneau [aut], Beth Atkinson [aut, cre], Brian Ripley [trl] (producer of the initial R port, maintainer 1999-2017)
Initial release
2019-04-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.