# Different distance matrixes result in the same clustering

I am using:

• the cluster::pam function in R for clustering
• distance matrix computed using Gower distance in cluster::daisy in R

The issue I am having is that I run pam 2 times, with a different distance matrix in each run, but I get the same cluster assignment in both runs!!

• Run 1: Distance matrix based on 13 attributes (11 integers and 2 binary)

• Run 2: Distance matrix based on 13 attributes as above + 1 integer attribute (almost uniform distributed)

If I run PAM for each distance matrix I get different average silhouette widths as expected. So far so good. Although it is strange to get such high numbers close to 1!

The problem is the unexpeted results I get when I look at the clustering assignement in each run. Both clustering assignments give the same results! Even though the average widths are different as shown above. Can someone please explain what am I missing. How can they be different? Thanks in advance

# EDIT

You can see below also the scatter plot between the 2 distances. Curiously the distance in the 2nd run is one of 3 values (0 or 0.5 or 1). Any ideas why this would happen?

• Exactly how different are these distance matrices? You can quickly and easily check by viewing a scatterplot of one against the other. Throwing in one more attribute along with 13 others is unlikely to change things much and perhaps it hasn't made any difference at all.
– whuber
Commented May 28, 2022 at 17:56
• @whuber thnx for the fast reply. So from the descriptive stats on the snapshot above you can see the differences to some degree (median of 0.5 for run 1, compared to a median of 0.3872 for run 2). Also the silhouette widths are different in each run (0.97 for pam on distance matrix of run 1, compared to 0.70 for run 2). So my question is how can the cluster assignments be identical! Commented May 28, 2022 at 18:00
• The descriptive stats are almost worthless. Of course the new distances will differ from the old ones. But if they scarcely change on a relative basis, one would expect the two solutions to be close, if not identical. That's why you need to examine your distance matrices.
– whuber
Commented May 28, 2022 at 18:08
• @whuber I will do the scatter plot and update accordingly. But even if there are minimal differences, how do we explain the big difference in the average silhouette width that still results in the same cluster assignment? Commented May 28, 2022 at 18:31
• Another thing is that the fact that the number of objects in the three clusters is the same doesn't automatically imply that the clusters are the same. It may well be that they are, but to demonstrate this clearly you'd need to table the cluster memberships against each other rather than just giving the numbers of elements. Commented May 28, 2022 at 22:24