# Comparing the integral of a histogram and its distribution function

I asked a question here but I did a rather poor job of explaining my problem the question was poorly formed.

If I have some histogram with $N_{total}$ number of total data points, and $N_{bins}$ number of bins. If I integrate across the maximum bin and the minimum bin, then I just get back $N_{total}$, likewise if I integrate between two bins on the histogram, I simply sum the counts within those two bin points.

Now I can fit a function, $f(x)$, that describes the histogram. If I Integrate the function $f(x)$ between two points - which correspond to two bins, what I want to get back is a value which is close to the total counts in the region between the two bins.

Is there a relation that I need to use which scales with the number bins, such that the result of the integral $\int_{max\ bin}^{min\ bin}f(x)\ \ dx \approx N_{total}$

I hope this is clearer than my first attempt!

• If you normalize the histogram and then estimate a curve with total area below it equal to 1, you've essentially re-created the procedure of kernel density estimation. – Sycorax Feb 9 '18 at 18:23
• What is on your other axis? People often show frequency, proportion or percent when the real scale is one of those per unit of the variable shown. – Nick Cox Feb 9 '18 at 19:08
• Is there some reasons why you have specified your integration interval from the maximum to the minimum values? Typically such ranges are expressed in the opposite direction, both for continuous integration notation $\int_{\min}^{\max}{f(x)dx}$ and for discrete summation notation $\sum_{i=\min}^{\max}{f(x_{i})}$. – Alexis Feb 12 '18 at 16:55
• Please don't start multiple threads for one question: just edit the original. – whuber Feb 12 '18 at 16:59
• @NickCox I simply use counts on the y-axis – QuantumPenguin Feb 12 '18 at 22:23