> 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:
>  
> > dados<-matrix(c(-1,0,2,2.5,7,9,0,3,0,6,1,4),6,2)
> 
> I will choose observations 3 and 4 for initial centers and just one iteration. The 
> results are
>  
> > A<-kmeans(dados,dados[c(3,4),],1)
> > A
> $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.


Andy Liaw already gave an example where he specified two different starting 
values and Kmeans gave different results after 1 iteration, so clearly 
your hypothesis is incorrect.

Either your calculations are wrong or you are calculating the wrong
formulae.  It is very doubtful that anything is wrong with Kmeans.

Doug Grove

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to