Library: | xclust |
See also: | cartsplitclass cartsplitregr cartpredict cartdrawpdfclass cartdrawpdfregr |
Quantlet: | cartdisptree | |
Description: | plots the regression/classification tree of CART in a display. |
Usage: | cartdisptree(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 |
; 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 cartdisptree(tr)
shows the tree with the splitting rules