In order to calculate the distance between two 1-D histograms, they must have the same number of bins. I'm wondering if it's preferable to have more or fewer bins for such calculation.

For example, suppose the Freedman-Diaconis estimator (or another estimator, e.g., Sturges' rule) yields a histogram A with 9 bins and a histogram B with 8 bins. I'd like to calculate the Jensen-Shannon distance between them. Should I increase the number of bins of histogram A to 9, or decrease the number of bins of B to 8? By "increasing" or "decreasing" the number of bins I mean recomputing the histograms with the new number of bins. Any other suggestions are welcome.

  • $\begingroup$ The meaning of "preferable" depends on the objectives of your calculation: what is the purpose? $\endgroup$ – whuber Apr 11 '18 at 17:36
  • $\begingroup$ The overall goal is to check the extent that two distributions change with time. And by "preferable" I mean if there's perhaps a correct or more theoretically sound way of thinking about the binning approach. $\endgroup$ – Bruno Apr 11 '18 at 19:00
  • $\begingroup$ Then don't use histograms! Edit your post to ask the question you really need answered. $\endgroup$ – whuber Apr 11 '18 at 19:06
  • 1
    $\begingroup$ Well, I guess I wouldn't need to get histograms specifically as density estimators and then calculate their distance. Maybe a two-sample KS test would do. $\endgroup$ – Bruno Apr 11 '18 at 19:31
  • $\begingroup$ Specially since the data are continuous anyway. $\endgroup$ – Bruno Apr 11 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.