CP {ModTools}R Documentation

Complexity Parameter of an rpart Model

Description

Extracts, prints and plots the complexity table of an rpart model.

Usage

CP(x, ...)

## S3 method for class 'CP'
print(x, digits = getOption("digits") - 2L, ...)
## S3 method for class 'CP'
plot(x, minline = TRUE, lty = 3, col = 1,
     upper = c("size", "splits", "none"), ...)

Arguments

x

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.

digits

the number of digits of numbers to print.

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) ("size"), the number of splits ("splits") or nothing ("none").

...

further arguments passed to print and plot

Details

The complexity parameter table is hidden deep in the entrails of the rpart result object, it is convenient to have a function to extract it.

Value

A list containing the following components:

cp

the complexity table

x

the rpart object

Author(s)

Andri Signorell <andri@signorell.net>

See Also

printcp, plotcp

Examples

r.rp <- FitMod(diabetes ~ ., d.pima, fitfn="rpart")

CP(r.rp)
plot(CP(r.rp))

[Package ModTools version 0.9.6 Index]