1
$\begingroup$
  1. When should one consider converting continuous variable into categorical variable ? Are there guidelines ? Is it justified to bin skewed variable ?
  2. How should I determine the range / binning when I do the conversion ? For example, if I have Annual Income per year as a predictor how do I decide the the range / bins as 20k to 50k, 51k to 80k and so on. Do the bins have to be equally spaced (fixed width) ?
  3. Is binning know to improve models like Random Forest ?
$\endgroup$
7
  • 5
    $\begingroup$ 1) When one is demonstrating poor practices, and perhaps not in any other situation. $\endgroup$
    – Dave
    Commented Jul 5, 2020 at 12:12
  • $\begingroup$ @Dave: Let's say I have age as a predictor variable, probably 22 year old subject is not very different from 23 old subject if I were to consider the impact of age. Similarly for annual income of 70k versus 72k. Is it not better to put them in ranges to be able to explain the results better ? (Pardon my ignorance) $\endgroup$
    – learner
    Commented Jul 5, 2020 at 12:17
  • 5
    $\begingroup$ 1. Never, 2. It's arbitrary, 3, Some models, such a logistic regression, are better with categorical variables, but by categorizing to begin with, you've already lost. See 1. $\endgroup$ Commented Jul 5, 2020 at 12:20
  • 2
    $\begingroup$ It's rarely a good idea to categorize some continuous predictor. One scenario where it makes sense is when this encodes knowledge that the analyst has. Examples could be (depends on whether it's relevant to what you are modeling): Is a person younger or older than the legal limit for buying alcohol? Is a person old enough to be covered under some health insurance scheme for the elderly? Does this income fall into a certain income tax bracket? $\endgroup$
    – Björn
    Commented Jul 5, 2020 at 12:29
  • 1
    $\begingroup$ @Björn good example. Despite my slightly flippant comment above, the correct answer is "very rarely". Another example where it would be appropriate is is in data protection / privacy, as part of pseudonymization. $\endgroup$ Commented Jul 5, 2020 at 12:35

0