6
$\begingroup$

I have a dataset:

5, 10, 11, 13, 15, 35, 50 ,55, 72, 92, 204, 215

The formula for binning into equal-widths is this (as far as I know) $$width = (max - min) / N$$

I think N is a number that divides the length of the list nicely. So in this case it is 3. Therefore:

width = 70

How do I use that 70 to make the bins?

EDIT: Found the answer. Should I answer my own question or just delete it?

$\endgroup$
  • $\begingroup$ You can answer your own question (maybe not now, but tomorrow it will be possible). $\endgroup$ – Davide Giraudo Nov 7 '13 at 10:07
  • 1
    $\begingroup$ Check the list of related questions to the right -> and perhaps try a search. If you can't find another question with an answer or answers that deal with your question, please go ahead and answer it yourself. If there is another question/answer that does answer your question, it would be better to delete. $\endgroup$ – Glen_b -Reinstate Monica Nov 7 '13 at 11:05
  • 1
    $\begingroup$ Two comments: I think that the number of bins is more typically not a factor of the sample size; there's no need for it to be. (Also, more typically, though not always, the first and last bin boundaries are placed at roundish numbers.) -- but the requirements of what you're doing may differ $\endgroup$ – Glen_b -Reinstate Monica Nov 7 '13 at 18:05
  • 1
    $\begingroup$ Mike, you might appreciate this assessment of histograms offered by @Glen_b in response to a related question. $\endgroup$ – whuber Nov 7 '13 at 20:41
  • 2
    $\begingroup$ 3 appears out of mid-air and is never explained. The question is mystifying on several different levels. 0. Why 3 here? 1. Why bin at all? You can show all the values directly in a dot or strip plot or a quantile plot. 2. Even if you bin, there are grounds (aesthetic and other) for nicer numbers such as lower bin limits 0, 50, 100, .. 3. Who says that bins all need to be populated? I have no problem with some empty bins showing gaps in the data. They are less misleading than wider bins. $\endgroup$ – Nick Cox Feb 26 '18 at 10:24
7
$\begingroup$

I found the answer. I was somewhat close with the question. The trick is that width is not just width, it is width of each interval.

Therefore

bin1: 5,10,11,13,15,35,50,55,72 I.e. all values between 5 and 75
bin2: 92 I.e. all values between 75 and 145    
bin3: 204,215 I.e. all values between 145 and 215

And for equal width binning you are given number of required bins and in this case it is 3.

$\endgroup$
  • 1
    $\begingroup$ I am still not getting this. How did you get N=3 and why not 4 or 2? Also, how did you divide them into 3 bins with those particular data points. I would highly appreciate any references as I also wanted to see how equal probabilities are done (in terms of chi-square ). $\endgroup$ – leviathan Dec 4 '13 at 0:03
  • 1
    $\begingroup$ The answer to 'I am still not getting this. How did you get N=3 and why not 4 or 2?' is that, the question itself asks for three bins with equal width. When the range of the sequence(max-min) is divided by the number of bins (N=3), the output yields the width of each bin(equal width of 70). Now that we have the width of the bin decided, we can easily divide the given sequence according to closed and open intervals to include every element of the sequence to be a member of some interval or the other.Hope this helps. $\endgroup$ – Indu May 7 '17 at 13:20
  • $\begingroup$ So, the question should be described as Binning By Equal-Width with 3 bins? $\endgroup$ – Nick Dong Feb 9 at 8:09
0
$\begingroup$

Binning is a unsupervised technique of converting Numerical data to categorical data but it do not use the class information. There are two unsupervised technique.

1-Equal width. 2-Equal frequency.

In Equal width, we divide the data in equal widths. In order to calculate width we have the formula.

width=(max−min)/N

So from the available data in the problem we have 75 is the width.

We divide the data with three categories:

5 to 75 75 to 145 145 to 215.

Now we keep the numbers in the above ranges.Thus,

bin1: 5,10,11,13,15,35,50,55,72 bin2: 92 will hold only one value as we have only one value exist between 75 and 145
bin3: 204,215.

$\endgroup$
  • $\begingroup$ This doesn't seem to say anything that isn't in the accepted answer $\endgroup$ – Nick Cox Feb 26 '18 at 11:15
  • 1
    $\begingroup$ why 75 instead of 70? The answer should give an example of 2-Equal frequency, either, since you mentioned this concept here. $\endgroup$ – Nick Dong Feb 9 at 8:06

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.