LeafRates {ModTools}R Documentation

Leafrates for the Nodes of an 'rpart' Tree

Description

Return the frequencies of correct and wrong classifications in given node(s) in tabular form. The 'purity', denoting the relative frequency of correctly classified elements, is a useful information for the interpretation of regression and classification trees and a measure for its quality.

Usage

LeafRates(x)

## S3 method for class 'LeafRates'
plot(x, col = NULL, which = c("rel", "abs"),
                         layout = NULL, ylim = NULL, ...)

Arguments

x

fitted model object of class rpart.

col

color for the bars in the plot

which

one out of "rel" or "abs", denoting whether relative or absolute frequencies should be used for the plot.

layout

vector defining the layout

ylim

the y limits of the plot.

...

further arguments (not used).

Details

The result comprises absolute and relative frequencies per leaf.

Value

A list with 5 elements consisting of:

node

the node id (of the leaf)

freq

the absolute frequency of correct and wrong classifications

p.row

the relative frequency of correct and wrong classifications

mfreq

the total number of cases

mperc

the percentage of the sample in the leaf

Author(s)

Andri Signorell <andri@signorell.net>

See Also

Node, Rules

Examples

r.rp <- FitMod(Species ~ ., data=iris, fitfn="rpart")
LeafRates(r.rp)

plot(LeafRates(r.rp))

[Package ModTools version 0.9.6 Index]