I am performing clustering by Gaussian Mixture model using EM algorithm in R. U use the mclust package. My data (205 observations and 25 variables) has both categorical and numerical variables. How do I deal with that problem?

My first thought is to transform my categorical variables to binary variables and then standardize the numerical variables in my data set. Is there any problem with that approach from a theoretical point of view?


1 Answer 1


Gaussian distributions are continuous distributions.

There is no meaningful way to apply this famous "bell shaped curve" onto categorical data - binary encoding clearly does not make sense either. You have to find something else to use instead of Gaussians...

So instead of hacking to make your data fake Gaussian, you should rather make the algorithm match your data and problem.

  • $\begingroup$ Do you have any suggestions on what algorithms would be a better fit for handling continuous and categorical values? $\endgroup$ Oct 18, 2019 at 14:34
  • $\begingroup$ The EM algorithm is fine, but you'll need to enhance it with a multinomial distribution, for example. That should be straightforward, just a little bit of math an a few lines of code afterwards. $\endgroup$ Oct 18, 2019 at 15:15
  • $\begingroup$ Curious, could one not apply some factor analysis of mixed data to transform the data into a continuous space? $\endgroup$
    – cs0815
    Jul 31, 2020 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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