I performed and plotted a kmeans analysis in R with the following commands:
km = kmeans(t(mat2), centers = 4)
plotcluster(t(mat2), km$cluster) #from library(fpc)
Here is the result from the plot:![enter image description here][1]
What I want to know is how to make sense of the km$centers
attribute and the plot. What I know is that km$centers
is a 4 X 31 matrix. Each row represents the corresponding cluster. I think each column represents an iteration in the algorithm (correct me if I am wrong) so the final iteration and result of the algorithm for the centers would be given by:
km$centers[, 31]
0.008785652 -0.088641371 -0.012666252 -0.079348292
I must be wrong about a lot because this leads to the following questions:
- The centers given by
km$centers
are not (x, y) coordinates. How do I get these (x, y) center coordinates? - The center for cluster 4 (according to the plot) must be something like (12, 2) but the above center numbers do not reflect any of these coordinates. In fact every number in the 4 X 31 matrix is less than 1. So, what is the relationship between
km$centers
and the plot?
The ultimate goal here is to create a matching (not mentioned here) based upon the (x, y) coordinates.
All help is greatly appreciated! [1]: https://i.sstatic.net/sBWIS.png