| Library: | graphic |
| See also: | cartsplit dispcart2 tree |
| Macro: | grcart2 | |
| Description: | produces the cut graphic for a CART tree. |
| Usage: | line = grcart2(x,tree,ix,iy,mindepth,minssr) | |
| Input: | ||
| x | nxp, X-variables used in cartsplit | |
| tree | list, result of cartsplit | |
| ix | scalar, which variable is taken for X | |
| iy | scalar, which variable is taken for Y | |
| mindepth | scalar, till which depth the tree should be shown | |
| minssr | scalar, shows all cuts which produce a SSR larger than minssr | |
| Output: | ||
| line | list, a graphical object that contains the cuts | |
randomize(1)
n=100
; Generate some simulated data
xdat=uniform(n,2)
ydat=120.*matrix(n,1)-(xdat[,2]<=0.5).*120-(xdat[,2]>0.5).*(xdat[,1]<=0.5).*20
ydat=ydat+normal(n)
; call CART
type=#(1,1)
opt=cartsplitopt("minsize",1,"mindev",0,"mincut",5)
tr=cartsplit(xdat,ydat,type,opt)
; shows cuts
d=createdisplay(1,1)
show(d, 1,1, xdat, grcart2(xdat, tr, 1, 2, 3, 0))
shows the data and the cuts till depth 3
| Library: | graphic |
| See also: | cartsplit dispcart2 tree |