# Given a dataset and no information about its distribution, how to determine bin size?

Let's say I have a $k$-vector of numeric data $X \in \mathbb{R}^k$, and I want to plot a frequency distribution of all the data points in the vector.

I've tried searching high and low for a method (explained from the first principles) to determine the number of bins (or equivalently, the optimal bin size) to use for plotting the frequency, but have only found rules of thumb so far- e.g. The square root choice from Wikipedia. However, firstly, the reasoning behind that formula or its derivation haven't been explained and secondly, I'm not sure that choice would work for any data set.

What method can we use to determine the appropriate bin size for a frequency distribution of the elements of $X$? Naturally, it would depend on the data itself and in that case, what analysis would need to be performed on it first, before proceeding to bin size calculation?

Thank you

• What are you doing it for? What should the choice of bins be good at? For example, if you seek to minimize AIMSE, you generally have way too few bins for a visual display -- a suitable choice for one isn't suitable for the other – Glen_b -Reinstate Monica May 30 '17 at 6:26
• @Glen_b: Yeah I should have specified the purpose. Let's say I have data on all of an organization's employee salaries. One purpose for a frequency distribution plot would be simply for visual data representation purpose, so that I can look at the plot and hopefully derive some useful inferences from it. With that purpose in mind, how should I approach it? Or is that purpose too vague? – Urysohn Lemma May 30 '17 at 7:14
• @Glen_b: Also for what reason would we seek to minimize the MISE? Would it be overkill to go with kernel density estimation for business analytics purposes (ref. the scenario in my earlier comment). – Urysohn Lemma May 30 '17 at 7:18