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

Data binning

  1. Apr 5, 2010 #1
    Hey all,

    I have a bunch of data that varies over many magnitudes. I was hoping to use log bins to capture the short and long term features of the data. My question is, how do I bin the data, and how do I assign appropriate errors so that I can fit the data to some theory (maybe a power law)?

  2. jcsd
  3. Apr 5, 2010 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Probably the most straightforward method is to rescale the data as y=log10(x), and then take equal intervals in binning the y data.

    Good question about the errors. I'm not absolutely sure, but I believe that the error would be ± the square root of the expected number of counts within a bin, at least when that count total is considerably greater than 1. This becomes problematic when the expected count is less than 1, for example 0.25±0.5 allows for negative counts, an unphysical result.

    Perhaps somebody who knows statistics better than I can provide a more accurate answer.
  4. Apr 6, 2010 #3
    Hey Redbelly98,

    thanks for your reply :) I will look into it and post back with results.
  5. Apr 6, 2010 #4
  6. Apr 8, 2010 #5

    I have modified the scripts on the page given in my previous reply, and uploaded a MATLAB file to MATLAB Central

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?