getsubtree {ConsRankClass}R Documentation

Determine a tree from the main tree-based structure

Description

Given a tree belonging to the class "ranktree", determine a subtree with a given number of terminal nodes

Usage

getsubtree(Tree, cut, tokeep = NULL)

Arguments

Tree

An object of the class "ranktree" coming form te function ranktree

cut

The maximum number of terminal nodes that the Tree must have

tokeep

parameter invoked by other internal functions

Details

If the pruning sequence returns a series of subtrees with, say, 1,2,4,7,9 terminal nodes and the user set cut=8, the function extract the subtree with 7 terminal nodes.

Value

An object of the class "ranktree", containing the same information of the output of the function ranktree

Author(s)

Antonio D'Ambrosio antdambr@unina.it

Examples


data("Univranks")
tree <- ranktree(Univranks$rankings,Univranks$predictors,num=50)
#see how many terminal nodes have the trees compomimg the nested sequence of subtrees
infoprun <- tree$pruneinfo$termnodes
#select the tree with, say, 6 terminal nodes
tree6 <- getsubtree(tree,6)



[Package ConsRankClass version 1.0.1 Index]