Other than computational ease/requirements - are there reasons to band continuous variables?

It seems to be a thing at my work place where everyone would split continuous data into 20-ish categories either by a normal distribution or a equal split, depending on what would give the best-looking one way graph with the response variable.

Is this normal? I don't really see why I would want to do this at all (other than computational limitations, but even then, why only 20-some groups?)- since it feels like manipulating my data to look like how I want it to look, and I can't imagine that whatever CI or p-value that I'd get from this would be accurate.

  • 1
    $\begingroup$ (+1) This is usually called "binning." $\endgroup$ – whuber May 31 '16 at 16:54

I think you hit on the main reason people tend to do this (in the context of linear models or glms) here

depending on what would give the best-looking one way graph with the response variable.

Especially in the context of a linear model, binning a continuous variable will introduce some non-linearity into the fit of that variable, allowing the model to adapt to a non-linear trend in that variable.

Another way to say this, when a pure linear fit in a certain variable produces considerable bias, binning the variable into multiple range indicators and fitting a parameter for each range will lower this bias. Of course, you are introducing many more parameters for your model to determine, so there is an associated increase in the variance of your model (its sensitivity to the data) which has the opposite effect of harming your out of sample perfomance. If the non-linearity in the trend is severe enough, the lowering of this bias will be the dominant effect, and you will end up with a more predictive model.

A subtle point is that, while the bias can be lowered for the model as a whole, there maybe considerable remaining local bias. If the true underlying effect changes rapidly in a single of your buckets, you will have a case where the bias is lower at the center of mass of the bucket, but at the edges of the bucket the model will be quite biased.

With that said this is still generally considered a poor practice (from a statistical or modeling standpoint) as there are better options available.

  • Often introducing a quadratic term into the fit can be effective. You can easily discover whether this will be the case with some exploratory data analysis and plotting. I generally stay away from adding cubic terms though, and instead go to

  • If the non-linearity is quite severe, consider using some natural cubic splines. These fit pwicewise cubic functions, with the constraint that the cubic pieces must match up smoothly. You can either set down the transition points (knots) by hand, as informed by more data exploration, or use an algorithm like gam to set them down automatically.

Of course, when using these techniques it's extremely important to make sure that they old up well on out of sample data, either with an explicit hold out, or by using cross validation.

Setting aside statistical reasoning for a moment, there may be context dependent reasons this is done in your industry. For example, the model may need to be approved by regulators or consumed by non-technical entities. It's up to you to weigh these concerns and state your case one way or the other.


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.