Library: | xclust |
See also: | kmeans adaptive agglom |
Macro: | divisive | |
Description: | performs an adaptive divisive K-means cluster analysis with appropriate (adaptive) multivariate graphic using principal components |
Usage: | cd = divisive (x, k, w, m, sv) | |
Input: | ||
x | n x p matrix of n row points to be clustered | |
k | scalar number of clusters | |
w | p x 1 matrix of weights of column points | |
m | n x 1 matrix of weights (masses) of row points | |
sv | scalar seed value for random numbers | |
Output: | ||
cd.p | n x 1 matrix partition of n points of x into k clusters | |
cd.n | k x 1 matrix of number of observations of clusters | |
cd. a | p x 1 matrix of final (pooled) adaptive weights of the variables |
; load the library xclust library ("xclust") ; initialize random generator randomize(0) ; generate basis data x = normal(30, 5) ; generate 4 clusters x1 = x - #(2,1,3,0,0)' x2 = x + #(1,1,3,1,0.5)' x3 = x + #(0,0,1,5,1)' x4 = x - #(0,2,1,3,0)' x = x1|x2|x3|x4 ; compute column variances w = 1./var(x) ; compute row weights m = matrix(rows(x)) ; apply divisive cd = divisive (x, 4, w, m, 1111) ; compare estimated and true partition conting (cd.p, 1+ceil((1:120)/30))
Content of object h [1,] 0 30 0 0 [2,] 0 0 30 0 [3,] 30 0 0 0 [4,] 0 0 0 30
Library: | xclust |
See also: | kmeans adaptive agglom |