Let's say you have a logistic regression model. Some of the factors are intrinsically categorical but some are continuous variables. Under which circumstances should a continuous variable be binned into categories?

For example, logistic regression is widely used in retail credit modeling, and age is an explanatory variable. When is it wise to bin age (e.g., 2-3, 4-10, 11+) and when should you leave it as a continuous variable?


4 Answers 4


The issues pointed out in the various footnotes and references here do not seem to address this issue. There are numerous situations where detailed intelligent binning is not only appropriate, but adds value to the model.

Let's break it down to the basics, which is that in a digital world every thing is categorical. We never measure AGE down to the second, minute, day, week or even month. Why not? Because we assume that at those minute intervals the response variable is the same. How is tat different from assuming that the response variable is the same for those between ages of 25 and 27, If the data shows that the credit risk for people with 10-15 years of credit history is the same, why would we assume there is a linear relationship there?

Isn't that just trying to impute more in the data than exists?

It is true that by discretizing the data we increase the available degrees of freedom, but only if we assume each interval is defined by a separate variable AND with large data sets (thousands of observations are not only common, but on the low side of many data sets). I think the problem with many comments here are from areas where sample sizes are small, biomed, social sciences, ... In the marketing and financial and other consumer worlds there is more data than you can shake a stick at.

Finally, binning has been an accepted and proven practice in the consumer industry since Fair, Isaac first started building scorecards, back in the 1960's. FICO still uses complex binning techniques for almost all of their models today. One of the current top data mining tools, TreeNet from Salford, is essentially based on binning techniques.

So, anyone who considers binning to not be best practice as a potential transformative technique is not behind the technology curve, way behind.

  • $\begingroup$ Hi Mike, welcome to quant.SE. Great answer, I completely agree that intelligent binning can add value to a model. You are essentially taking a somewhat Bayesian view that priors should be imposed, even when using classical statistical tools. $\endgroup$ Commented Jul 23, 2012 at 13:42
  • $\begingroup$ Is there a reference to back these assertions? $\endgroup$
    – Jase
    Commented Aug 15, 2013 at 12:10

According to Frank Harrell's useR2010 keynote on Information Allergy: Never.

Edit: And here is a long list of reasons why one should not categorize continuous variables (which is the same thing, but expressed in more statistical terms). And for completeness, here is Andrew Gelman debating the issue some more.

  • $\begingroup$ Any particular reason as to why? $\endgroup$
    – user40
    Commented Feb 10, 2011 at 16:07
  • 1
    $\begingroup$ You should probably look at the slides, or watch the video, for details. $\endgroup$ Commented Feb 10, 2011 at 16:10
  • $\begingroup$ I am a practitioner in the field and I don't subscribe to that view. $\endgroup$
    – xiaodai
    Commented Aug 15, 2013 at 9:01
  • $\begingroup$ @xiaodai Why not? Your answer doesn't actually answer this question. $\endgroup$
    – Jase
    Commented Aug 18, 2013 at 3:49

I think binning is the superior approach in most cases.

I am a practitioner in the field and I have used both continuous transforms and binning approaches.

In practical terms in a model there would be around 10 factors. If your model development dataset is large and robust enough, you could easily have binned each of the 10 factors into 10 bins. Roughly speaking, using the binned scorecard you could then assign $10^{10}$ different scores to your customers. This is way larger than any bank's customer base. So don't worry too much about your model not being granular enough. In mostly cases it will be.

For datasets with small sample size, you will likely end up with adjacent bins with large point differentials. This is not desirable! You don't want your customer's scores' to change so drastically if he/she is simply moving to the adjacent bin in one of the factors. In practise I have overcome this by simply employing an automated binning algorithm on the data, and bootstrapping it 100 times. If you think of binning as a step function that maps raw values to a WOE then simply taking the average of the 100 bootstrapped binning will naturally smooth out sudden jumps in WOE. This will make the large point differential problem go away. This method is completely data-based and does not need any other subjective input.

In other approaches where a continuous function is fitted the analyst building the model often have to look into limiting the range of values where the curve should be fitted. This could be due to the data sample being not robust enough near the ends of the distribution (e.g. for income variables, very few of your customers would be earning \$10 million+, so someone has to subjective choose where to stop fitting the function say at $1 million). This is all manual and does not lend well to automation. The bootstrapped binning approach in the above paragraphs avoids this problem.

Binning approach is also easier to implement as a series of if statements should suffice.

Generally even though I use continuous transforms sometimes, I prefer binning and use it whenever it is possible. If your sample size is really small and you have less than 30 defaults to even apply binning, then you may want to relax the bad definition and lengthen your observation period. However even if that does not bring your total bad counts up to around 60~70 then continuous transform might be the way to go.

  • $\begingroup$ This doesn't actually explain why it's better to bin. $\endgroup$
    – Jase
    Commented Aug 16, 2013 at 15:31

All answers here are quite relevant. To add, in a world of large datasets there is a simple proof why binning might be better than continuous variable - those are models based on trees (specifically random forests and trees boosting). On a quite large dataset they almost always perform better than any smart splines or other non-linear transformations to the linear model. One might say that this is due to model averaging - but why then boosting and bagging of linear regressions almost never win boosting and bagging of trees? That's because if you have sufficient data, smart techniques of latest binning algos inside decision trees simply performs better on highly non-linear datasets without much time to tune those models


Your Answer

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

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