Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Cluster analysis
See also: agglom

Function: tree
Description: generates from a binary tree an output for plotting.

Link:
Usage: g = tree (t, cut {, opt})
Input:
t n x 2 matrix produced from agglom
cut scalar the cut-off value for the tree
opt text matrix of optional parameters
Output:
g.points m x 2 matrix for drawing trees via show
g.index m x 1 matrix of indices

Note:

Example:

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()
Result:

shows as result the dendogram for all 200 swiss banknote data

Group: Cluster analysis
See also: agglom

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

(C) MD*TECH Method and Data Technologies, 17.8.2000