I am trying to do clustering on my data which consists of both categorical and continuous variables. I have some questions which I would like to ask:

  1. I am going to use the Gower Distance measure to find the similarties/dissimilarties between data points is that ok?

  2. Can I use K-Means clustering for mixed variables to perform clustering? If not I will use Two-Step Clustering but can Two-Step Clustering be performed in R? Also, if so which Hierarchical Algorithm will I have to use?


  • 1
    $\begingroup$ Please search "K-means Gower" on the site. The question was asked several times already $\endgroup$ – ttnphns Mar 1 '19 at 9:39
  • $\begingroup$ @ttnphns - I have researched even before questioning here but there is not like a definite answer to my question as some of the answers are saying you can use K-Means some not and I don't know what I should actually do $\endgroup$ – Annalise Azzopardi Mar 1 '19 at 10:39
  • $\begingroup$ Please see my latest addition to here stats.stackexchange.com/a/15313/3277 $\endgroup$ – ttnphns Mar 1 '19 at 12:02
  • $\begingroup$ Two-step clustering (found in SPSS) acceps interval or nominal variables, but not ordinal or binary. stats.stackexchange.com/a/116859/3277. For nominal ones, it uses log-likelihood distance. $\endgroup$ – ttnphns Mar 1 '19 at 12:08
  • $\begingroup$ @ttnphns - I know about the Two Step Clustering but I am using R and it seems that there is no package that can be applied $\endgroup$ – Annalise Azzopardi Mar 1 '19 at 12:49

K-means can only be used in data sets where you can compute the arithmetic mean.

Use hierarchical clustering instead. It can use distance matrixes, including Gower distances.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.