Skip to content
Prev 33016 / 398525 Next

Kmeans again

Dear helpers
 
I'm sorry to insist but I still think there is something wrong with the function kmeans. For instance, let's try the same small example:
I will choose observations 3 and 4 for initial centers and just one iteration. The results are
$cluster
[1] 1 1 1 1 2 2
$centers
   [,1] [,2]
1 0.875 2.75
2 8.000 2.50
$withinss
[1] 38.9375  6.5000
$size
[1] 4 2
 
If I do it by hand, after one iteration, the results are
 
$cluster
[1] 1 2 1 2 1 2
 
So I think that something is wrong with the function kmeans; probably the initial centers given by the user are not being taken into account.