# Optimal binning methods for categorical variables

I'm running a multinomial logit to predict the outcome of a categoric response variable. I have both continuous and categoric independent variables, and I know it's bad practicde to bin the continunous ones. For the categoric, however, I've seen it's very used (and it makes sense, specially since I have a lot of observations) to make dummies out of the n-1 categories. I also don't have too many categories in each categoric variable (less than 20), and not many categoric variables in total.

But I was wondering which is better: to simply make dummies for the n-1 categories, or to create bins using any binning method, like IV, WoE, Chi square, KS?

Intuitively I feel like creating dummies would be better since you're capturing precisely the effect of each category, while with the bins you're always losing a bit of predictive power because you're joining them.

• I wouldn't state that binning a continuous variable is always a bad practice. It depends. Sep 7 '20 at 19:52
• Yeah, "always" is never true haha but most of the times. The thing is that for my study I decided that it is not suitable. Sep 7 '20 at 19:55
• By common definition, binning aka discretization aka categorization is for continuous variables only. What you are asking about categorical variables is combining them into bigger, fewer categories. This should go with tag [many-categories], I might suggest. Sep 7 '20 at 19:57
• ah, thank you! I have always called it the same for both types of variables. Just changed the tags. Sep 7 '20 at 20:02
• Sep 7 '20 at 20:31

As @ttnphns indicates in the comments, you are asking whether you should collapse categories of a categorical variable into fewer "levels" of the category. There is nothing wrong with this approach and is sometimes a necessity. For example if you have a categorical variable with, say, 1000 categories, but you can logically collapse these into a only two categories that makes sense in the context of your analysis, then you should do so. Indeed, using the original 1000 categories, generally uses $$p-1=999$$ degrees of freedom in your model. However, if you then collapse these categories into only 2 categories, this will consume only a single degree of freedom: you model will then only contain 1 dummy variable in your model, rather than 999 dummy variables.