Learn R Programming

DStree (version 1.0)

snip: Cost-complexity Pruning of a DStree Object

Description

Determines a nested sequence of subtrees of the supplied DStree object by recursively snipping off the least important splits, based on the complexity parameter (cp).

Usage

snip(tree, cp)

Arguments

tree
a fitted object of class "DStree"
cp
complexity parameter to which the DStree object will be trimmed

Value

A new DStree object that is trimmed to the value cp.

Examples

Run this code
data(cost)
d.cost <- dis.cost(cost)

fit <- DStree(time~prevStroke+age+sex+alcohol+smoke,status="status",data=d.cost)

sfit<-snip(fit,cp=0.02)
plot(sfit) #plot smaller DStree object

Run the code above in your browser using DataLab