proc()=main()
; load the swiss banknote data
x=read("bank2")
; compute the euclidean distance between banknotes
i=0
d=0.*matrix(rows(x),rows(x))
while (i.<cols(x))
i = i+1
d = d+(x[,i] - x[,i]')^2
endo
d = sqrt(d)
; use the WARD method to cluster the data
t = agglom (d, "WARD", 3)
; generate now the dendrogram for drawing
g = tree (t.g, 0)
g=g.points; build lines
l = 5.*(1:rows(g)/5) + (0:4)' - 4
setmaskl (g, l, 0, 1, 1)
setmaskp (g, 0, 0, 0)
; create a display for drawing
d = createdisplay (1,1)
; show the dendrogram
show (d, 1, 1, g)
endp
;
main()