initial.Centers {clusterSim} | R Documentation |
Calculation of initial clusters centers for k-means like alghoritms
Description
Function calculates initial clusters centers for k-means like alghoritms with the following alghoritm (similar to SPSS QuickCluster function)
(a) if the distance between and its closest cluster center is greater
than the distance between the two closest centers (
and
), then
replaces either
or
, whichever is closer to
.
(b) If does not replace a cluster initial center in (a), a second test is made:
If that distance
greater than the distance between
and its closest
, then
replaces
.
where:
- initial center of i-th cluster
- vector of k-th observation
- Euclidean distance
=
Usage
initial.Centers(x, k)
Arguments
x |
matrix or dataset |
k |
number of initial cluster centers |
Value
Numbers of objects choosen as initial cluster centers
Author(s)
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
References
Hartigan, J. (1975), Clustering algorithms, Wiley, New York. ISBN 0-471-35645-X.
See Also
Examples
#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),])