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 |
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) (" |
... |
further arguments passed to |
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 |
Author(s)
Andri Signorell <andri@signorell.net>
See Also
Examples
r.rp <- FitMod(diabetes ~ ., d.pima, fitfn="rpart")
CP(r.rp)
plot(CP(r.rp))