Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Logarithimc binning

  1. Apr 10, 2017 #1
    Hello everybody,

    I have a problem with the logarithmic binning of some data (which are expected to be distributed as a power law). I found this https://www.physicsforums.com/threads/exponential-binning.691834/
    What "mute" says is exactly what I need: equally spaced bins on a logscale to estimate the exponent of a power law via the histogram. However, doing what he says doesn't make me obtain equally spaced bins.
    However, the real problem is that I can't find anywhere a reference to study that makes me understand how to do an histogram with logarithmic binning.
    Can someone help me with some suggestion or reference?

    thanks!
     
  2. jcsd
  3. Apr 10, 2017 #2

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    In the linked thread, the right side of the equation should have k instead of the logarithm of k.
     
  4. Apr 12, 2017 #3
    ok, now it make sense, but it still not perfect. The content of the first bins, when divided for the bin lenght, becomes higher than the right value.

    https://arxiv.org/pdf/1011.1533.pdf Here the author says that is convenient to use a normal binning until the noise becomes relevant (but doesn't explain why). In this way it works.
    Can someone explain me why or give me some reference about all that stuff?
    Thank's.
     
  5. Apr 12, 2017 #4

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    What do you compare with what?


    I would use an unbinned fit, but it is hard to tell more without a better description of your problem.
     
  6. Apr 12, 2017 #5
    I compare with the histogram I obtain when the bins are equally spaced (really equally spaced, not in logscale).
    The problem is more or less this: when plotting the histogram on a logscale with equally spaced bins, I have a straight line up to a certain value of x. Going over that value the fluctuations become relevant and I have no more a straight line, covering the data many y-values in a little x-interval (this is due to the fluctuations and to the logscale: in the interval 1000-10000 I have a very big number of fluctuating points in a x-unitary segment).
    To avoid this problem I do the logarithmic binning: in this way I have always the same number of points in a x-unitary segment, being the bins more and more long. This allow me to have the straight line also on the tail of the histogram. But, I repeat, for too small x I have a value which is not consistent with the value of the histogram without log-binning.
    I'm new in the field, but as I know it is a standarnd way of working (you will understand surely if take a look at the paper I posted: my non-log-binned histogram is like the one they present in figure 3).
    Thank's.
     
  7. Apr 12, 2017 #6

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    What do you mean by "consistent"? What is inconsistent?
    I understand figure 3, but I don't understand what you get if you don't show it, or at least describe it clearly. But showing it is much better.
     
  8. Apr 14, 2017 #7
    upload_2017-4-14_17-10-37.png
    As you can see in the log-binned case I have an overstimation of the frequency for small x.
    The article I posted says something very general, whitout explanations, that is: "data are best left unbinned for small x"
    I think the behaviour I obtain is due to the fact that when I divide for the bin size, It's smaller than one. However I don't think it's a good
    justification because for a small bin I should have a few data in it, so this two facts should balance themselfes. However, do you know anything can help me?
    Thanks.
     
  9. Apr 14, 2017 #8

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Are your x-values integers? Then you can run into the problem where you have a bin "between 0.8 and 1.1", for example, which gets all the content of the "1"-bin, but a bin width that is too small. Keeping the linear bin width avoids this problem.
     
  10. Apr 17, 2017 #9
    Yes, this is the case: I have integer variables.
    In fact, I found the best way to do the histogram is using a linear binning with unitary bin lenght until the fluctuations becomes relevant and then smoothing them via the logarithmic binnig. I found this also in the case of a non integer variable, but in this case I needed to divide for the bin lenght also the data with constant bin lenght. In this way I have unitary area under my histogram.
    Do you think there is anything wrong in my method?
     
  11. Apr 17, 2017 #10

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Sounds fine.
     
  12. Apr 19, 2017 #11
    thanks for all!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Logarithimc binning
  1. Data binning (Replies: 4)

  2. Binning of a variable (Replies: 8)

Loading...