23
votes
Why should binning be avoided at all costs?
It is a slight exaggeration to say that binning should be avoided at all costs, but it is certainly the case that binning introduces bin choices that introduce some arbitrariness to the analysis. ...
22
votes
Why is it Bad to Discretize a Continuous Variable?
There are two main issues here that militate against discretisation into bins for statistical analysis. The first is that this generally involves some loss of information, since different values are ...
13
votes
Why is it Bad to Discretize a Continuous Variable?
Others answers have discussed how discretization throws away information, which can hide effects which would be discovered if the continuous data were used. But sometimes the loss of information ...
12
votes
Accepted
Can I retain the ordinal nature of a predictor while answering a question about it that is inherently binary?
Binning X will make problems 1 and 2 worse. Comparison of X=1-3 vs. X=4-5 is inherently ill-defined and uninterpretable unless the relationship between X and Y is flat when X=1-3 and when X=4-5. ...
10
votes
Characteristic of good binning for weight of evidence algorithm
The 5% condition is a rule of thumb for Weight of Evidence (WOE) binning. In general, a good WOE binning of a variable should also have the following characteristics:
1. Monotonous increase/decrease ...
7
votes
Regression as classification: advantages?
The question gives a number of possible advantages, so I will post possible disadvantages. It is then up to the scientist to evaluate the tradeoff between possible advantages and disadvantages.
The ...
6
votes
Accepted
Can the 'bin size' in a histogram be thought of as a regularity constraint?
Yes, this is a reasonable way to think about it (assuming the histogram is normalized to obtain a proper pdf). Bin width constrains the smoothness of the density estimate (speaking loosely, since ...
6
votes
What is the benefit of breaking up a continuous predictor variable?
I'm a committed fan of Frank Harrell's advice that analysts should resist premature discretization of continuous data. And I have several answers on CV and SO that demonstrate how to visualize ...
6
votes
A data-independant transformation to discretize a range of values non-uniformly
Use quantiles.
The lowest 10% are the first bin, the next 10% are the second bin ...
If you hypothesize a data distribution, you can also use quantiles of the distribution for such a binning.
For ...
6
votes
Can I retain the ordinal nature of a predictor while answering a question about it that is inherently binary?
To expand and complement Frank Harrell's answer:
Providing an answer to the binary question based on the full model
First, I think there is value in giving your collaborator a bit of pushback on ...
5
votes
Number of bins when computing mutual information
The following binning rules should be added to Simone's list, which have become even more commonplace:
Given that mutual information is the sum of marginal entropies adjusted by their joint entropy, $$...
5
votes
Benefits of using QQ-plots over histograms
Since this question has returned to the top... I see many arguments against histograms in favour of qqplots but I'm not entirely convinced. Consider this example:
...
5
votes
R: Automatically group the insignificant dummy levels and re-fit the model
As whuber indicated in the comments, this is a bad idea.
The $p$-values of the new model will be inaccurate because they won't account for how you selected the model based on previous $p$-values.
...
5
votes
Accepted
Where can I find more materials on 'binning' after PCA?
Let's draw a picture with two variables. It will illustrate the general idea.
To achieve this, I generated a set of 500 data with expected correlation of $0.25$, computed the first principal ...
5
votes
Why should binning be avoided at all costs?
Imagine you have a watch that shows only the hours. By only I mean that it has only the hour arrow that once an hour makes a 1/12 jump to another hour, it does not move smoothly. Such clock wouldn't ...
5
votes
Regression to Classification and back to Regression
Short answer: It is most likely not reasonable.
While the question lacks details of the actual goal of the analysis, my best guess is that you assume your response to be nonlinear, since the ...
5
votes
Should discretized continous varibles be treated as numeric or ordinal (in a GLM)?
Even though it looks like you still only have one predictor when you write the model
glm(NoClaims ~ ageBinned)
what you've actually done by binning is to define a ...
5
votes
Why is it Bad to Discretize a Continuous Variable?
A different issue is that the categorical model may be unnecessarily hard to fit, caused by the philosophical mismatch of the model to the problem.
Suppose I have a large spring. The farther I pull it,...
5
votes
Accepted
Methods to derive cut-offs for continuous variables
Don't do this, as it particularly doesn't make sense for a random forest model. In addition to the many reasons that categorizing a continuous predictor is a bad idea, it undercuts a potential ...
4
votes
Interpolating binned data such that bin average is preserved
Mean preserving or average preserving splines can be generated from "normal" interpolating splines. Your requirements:
$\frac{1}{x_{i+1}-x_i} \int_{x_i}^{x_{i+1}} f(x) \text{d}x = \text{avg}...
4
votes
Interpolating binned data such that bin average is preserved
Here is a paper that describes an iterative method that does what you're asking:
Mean preserving algorithm for smoothly interpolating averaged data
M.D. Rymes, D.R. Myers, Mean preserving ...
4
votes
Multinomial logistic regression, weighted logistic regression?
Whatever the problem is, you should not be binning a continuous response. You didn't give us much context, so advice is difficult to give, please add more context. But you say "there are a lot of ...
4
votes
Scott's and Freedman–Diaconis rules of the thumb for selecting bin width - disatvantages
Comment continued. Here is a mixture of three normal samples (each of size 50) with
means sufficiently far apart, relative to their standard deviations,
to show separate modes. The default binning in ...
4
votes
Why should binning be avoided at all costs?
I would normally argue strongly against categorisation of continuous variables for the reasons well expressed by others notable Frank Harrell. In this case it might be helpful though to ask oneself ...
4
votes
Accepted
A data-independant transformation to discretize a range of values non-uniformly
The most general solution uses a nondecreasing function $F:(0,1]\to[0,1]$ and the desired interval $(a,b]$ of values to bin.
To create $n$ bins, divide the unit interval $(0,1]$ into $n$ non-...
4
votes
Difference between equal frequency and quantile binning
For data that are continuous and have not been rounded so much that
there are ties, both of the methods can be used to make intervals with equal counts, provided that the number of intervals is an ...
4
votes
How to calculate the mean from bin endpoints and frequencies?
Because your data is binned into intervals, you cannot really calculate the original sample mean because you should not make up information that you don't have access to. However, you have a couple of ...
3
votes
Multinomial logistic regression, weighted logistic regression?
I agree with @kjetil that binning is a bad idea.
If the reason for binning is "legitimate 0 values" then you can consider methods for zero inflation. These are better known when the dependent ...
3
votes
Binning By Equal-Width
So far, all the answers have proposed a representation of the histogram that is, in a sense, biased. Bias is not necessarily bad, but it is good to recognize it and to be able to control it.
The bias ...
3
votes
What is the benefit of breaking up a continuous predictor variable?
If a variable has an effect at a specific threshold, create a new variable by binning it is a good thing to do. I always keep both variables, original one and binning one, and check which variable is ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
binning × 266regression × 35
histogram × 33
r × 31
continuous-data × 19
machine-learning × 18
categorical-data × 18
classification × 16
clustering × 16
logistic × 13
distributions × 11
chi-squared-test × 10
data-visualization × 9
discrete-data × 9
modeling × 8
descriptive-statistics × 8
time-series × 7
probability × 7
python × 7
mean × 7
ordinal-data × 7
count-data × 7
multiple-regression × 6
generalized-linear-model × 6
references × 6