| Library: | graphic |
| See also: | grcart2 cartsplit tree |
| Quantlet: | dispcart2 | |
| Description: | produces the cut graphic for a CART tree in a user specified display. |
| Usage: | dispcart2(cartdisp,xnw,ynw,x,tree,ix,iy,mindepth,minssr) | |
| Input: | ||
| cartdisp | display for showing the cuts | |
| xnw | scalar, column number of window | |
| ynw | scalar, row number of window | |
| 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 | |
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(2,2)
dispcart2(d, 2, 2, xdat, tr, 1, 2, 3, 0)
shows the data and the cuts till depth 3 in the lower right window of the display
| Library: | graphic |
| See also: | grcart2 cartsplit tree |