| Library: | xclust |
| See also: | kmeans adaptive distance agglom wardcont |
| Quantlet: | kmcont | |
| Description: | performes a K-means cluster analysis of the rows of a contingency table including the multivariate graphic using the correspondence analysis; makes available the factorial coordinates (scores) |
| Usage: | ck = kmcont (x, k, t) | |
| Input: | ||
| x | n x p matrix of n row points to be clustered (the elements must be >= 0 with positive marginal sums) | |
| k | scalar: The number of clusters | |
| t | n x 1 matrix of the true partition (only if known, else a matrix containing 1) | |
| Output: | ||
| ck.y | n x l matrix: correspondence analysis scores of the row points (l = min(n-1,p-1) | |
| ck.z | p x l matrix: correspondence analysis scores of the column points | |
| ck.b | n x 1 matrix: Partition of n points into k clusters | |
| ck.c | k x p matrix of average profiles of clusters | |
| ck.v | k x p matrix of within cluster inertias divided by the corresponding weights (masses) of clusters | |
| ck.s | k x 1 matrix of weights (total row profile) of the rows | |
| ck.a | p x 1 matrix of weights (inverse total column profile) of the columns | |
; load the library xclust
library ("xclust")
; generate some data
x = #(4, 4, 25, 18, 10)~#(2, 3, 10, 24, 6)~#(3, 7, 12, 033, 7)~#(2, 4, 4, 13, 2)
; generate true partition
t = matrix(5)
; apply kmcont
ck = kmcont(x, 2, t)
gives a partition gk.b of 5 row points into 3 clusters which minimizes the sum of within cluster inertias
| Library: | xclust |
| See also: | kmeans adaptive distance agglom wardcont |