3
$\begingroup$

I have to apply PCA on a dataset, which contains both numerical and categorical values. In the preprocessing phase, I converted all the categorical values in numerical, so that the software can deal with them (basically I created dummy variables). Now, in order to apply PCA I have to scale the data matrix such that I have mean equal to 0. My question is: does it make sense to normalize also the categorical values (which now are numbers, but they are actually categorical values)? I think it doesn't, but in that case how do I proceed? I do the PCA without scaling these variables?

Thanks!

$\endgroup$
5
$\begingroup$

You can not use PCA, or at least it is not recommended, for mixed data. It is best to use Factor analysis of mixed data. You are lucky that Prince is a Python package that covers all data scenarios, borrowing from its explanation:

  • All your variables are numeric: use principal component analysis (prince.PCA)
  • You have a contingency table: use correspondence analysis (prince.CA)
  • You have more than 2 variables and they are all categorical: use multiple correspondence analysis (prince.MCA)
  • You have groups of categorical or numerical variables: use multiple factor analysis (prince.MFA)
  • You have both categorical and numerical variables: use factor analysis of mixed data (prince.FAMD)

Check also this question/answers in stats.stackexchange or discussion in researchgate.

$\endgroup$

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.