# Histogram with variable bin widths for (estimating distribution functions)

I've got a small set of data of size vs probability within an interval. The intervals (which I would want bin width to correspond too) are variable in width, e.g.' bin widths are

{{0, 9}, {9, 12}, {12, 16}, {16, 21}, {21, 33}};


I started by assigning associated probabilities for the above intervals:

data={.1, .15, .25, .25, .15, .05};


I then tried a bunch of different variations on using this data with Histogram to get a histogram of the probabilities/frequencies for each interval/bin but have been having a lot of trouble (its been many, many years since I did a bit programming back at uni and thought Mathematica might be a good way to reintroduce myself!). I've tried various approaches to taking transposes of lists of the data by various mean to get data into {start, end, height} format. Another post on here appears to have done this, but they used a PDF to generate a huge list of random points, from which the histogram was created, but I've already got the probability of particle sizes. Plus, I copied and pasted the code and got Mathematica to print the results form this, which just generated a huge number of values. I suppose I could use something similar to create a series of random numbers within each interval and then use that, but that seems like a cumbersome alternative?

I don't want to use the RectangleChart option as I'd like to fit different distributions over the data, which it doesn't look like it can be readily done with RectangleChart (could be completely wrong on this so would appreciate suggestions here too.

Thanks,

Alex

-
I'm still not sure what you need, is this answer helpful? mathematica.stackexchange.com/a/35597/5478 –  Kuba Feb 6 at 16:00

xs = Union@Flatten[{{0, 9}, {9, 12}, {12, 16}, {16, 21}, {21, 33}, {33, 34}}];

Now you can plot any other function (such as a pdf that you are interested in comparing) in the normal way. If you are unsure how this works, the help file for Plot has several examples.