Home | News | Documentation | Download

Query on normalising a histogram


ROOT Version: 6.16/00
Platform: Ubuntu 18.04.4 LTS
Compiler: gcc 7.5.0


Hi,
I saw this post on different choices of normalization. It’s a great post.

What I am a little confused about is what should be the ideal label of Y-axis. These few occasions I figured out (I guess), just wanted to confirm.
Method-4 gives a histo that is normalized to 1(i.e. the total area), right?
Method -6,7 are equivalent and gives (1/N)(dN/dx) as Y-axis.
Method-5 gives (dN/dx) as Y-axis.
Method-1 gives (dN/dx) as Y-axis, too.
Method-3 gives (1/N)(dN/dx) as Y-axis (according to this post)
Method-2 I am not at all sure.
So, could you please confirm if I’m getting these wrong or not?

Regards,
Saumyen

I guess you can just try the various ways and see what you get .
You can also check the documentation of the various
methods used in that post (Scale, Integral …)

Thanks, Olivier for the response.
I actually did that. What I found (comparing the Integrals) is that Method-1, 5 are equivalent, so are Method-2, 4 and Method-6, 7. Am I right?
But, if Method-3 is with Y-axis as (1/N)(dN/dx), what will be the axes for Method-6,7 and also for Method-1,5? For Method-3, I noticed the integral is greater than 1. Below are the plots I got.

But I don’t know how to label the Y-axis.

Regards,
Saumyen

I looks like more a question for @moneta.

Hi,
When normalising an histogram there are two possibilities:

  • normalize to show frequency probability ( Sum of all histogram bins = 1)
  • normalize to show a probability density function (Sum of all histogram bins * bin width = 1

The way to do is (and the correct one ) is to use

histo->Scale(1./histo->Integral());

for the first case and

histo->Scale(1./histo->Integral(), "width");

for the second one. The other methods are small variants implementing something similar, and I would forget about them. They could generate confusions and in some case wrong results

Lorenzo

Thank you so much, Lorenzo. It was of good help.

Thanks a lot.
Saumyen