Library: | xclust |
See also: | cartsplitclass cartsplitregr cartpredict cartdrawpdfclass cartdrawpdfregr |
Quantlet: | grcarttree | |
Description: | generates the graphical objects for the regression/classification trees. |
Usage: | {g, gp} = grcarttree(tr,string) | |
Input: | ||
tr | list of vectors, data structure representing a binary tree, output from cartsplitregr or cartsplitclass. See cartsplitclass or cartsplitregr for detailed description. | |
string | string, optional, either "NumberOfPoints", "Impurity" or "Class", default: see notes below | |
Output: | ||
g | composed graphical object, represents the CART tree | |
gp | composed graphical object, represents the text labels for CART tree |
; loads the library xclust library("xclust") ; generates an artifcal data set x1=#(0,0,0,0,1,1,1,1,1,2) x2=#(0,0,0,0,0,0,0,1,1,1) x=x1~x2 y=#(0,0,0,0,100,100,100,120,120,120) ; runs CART on our data tr=cartsplitclass(x,y,0,1) ; plots CART tree d = createdisplay(1,1) {g, gp} = grcarttree(tr) show(d, 1, 1, g, gp)
shows the tree with the splitting rules