initial.Centers {clusterSim} | R Documentation |
Function calculates initial clusters centers for k-means like alghoritms with the following alghoritm (similar to SPSS QuickCluster function)
(a) if the distance between x_k and its closest cluster center is greater than the distance between the two closest centers (M_m and M_n ), then x_k replaces either M_m or M_n, whichever is closer to x_k.
(b) If x_k does not replace a cluster initial center in (a), a second test is made: If that distance d_q greater than the distance between M_q and its closest M_i, then x_k replaces M_q.
where:
M_i - initial center of i-th cluster
x_k - vector of k-th observation
d(...,...) - Euclidean distance
d_{mn} = min_{ij} d(M_i,M_j)
d_q = min_i d(x_k,M_i)
initial.Centers(x, k)
x |
matrix or dataset |
k |
number of initial cluster centers |
Numbers of objects choosen as initial cluster centers
Marek Walesiak marek.walesiak@ue.wroc.pl, Andrzej Dudek andrzej.dudek@ue.wroc.pl
Department of Econometrics and Computer Science, University of Economics, Wroclaw, Poland http://keii.ue.wroc.pl/clusterSim
Hartigan, J. (1975), Clustering algorithms, Wiley, New York.
#Example 1 (numbers of objects choosen as initial cluster centers) library(clusterSim) data(data_ratio) ic <- initial.Centers(data_ratio, 10) print(ic) #Example 2 (application with kmeans algorithm) library(clusterSim) data(data_ratio) kmeans(data_ratio,data_ratio[initial.Centers(data_ratio, 10),])