Hi, I have a question about unweighted histogram and weighted histogram when I try to do Chi2Test() to 2 histograms. I have 2 histograms h1 h2. Simply create them and then fill fill fill. They both have 100 bins. Then I call
h1->Chi2Test(h2,"UU P");
Result reads:
Chi2 = 108.022299, Prob = 0.152939, NDF = 94, igood = 3
But when I change option “UU” to “UW”, result simply change to:
Chi2 = 112.474049, Prob = 0.0941032, NDF = 94, igood = 3
Then option “WW” has result:
Chi2 = 262.364015, Prob = 7.85054e-18, NDF = 94, igood = 3
which is very different. I look up to the Chi2Test() function but don’t get much answer. Also I don’t understand NDF=94 which I thought should be 99. Can anyone give me a hint? Thanks.
If the histogram represents simple counts, i.e. how many times the variable (e.g. x) is in a corresponding bin, then the histogram is unweighted.
In this case you fill the histogram calling TH1::Fill passing only the variable value (e.g. x) or using a weight value=1.
If you fill the histogram with weights different than one then the histogram is weighted.
In your case if the histogram is unweighted you should use the ‘UU’ option. However using as weighted or unweighted the result should be the same.
If you can send me the two histograms, I can maybe understand better your problem.
Hi,
Thank you for your reply. You’ve answered most of my problem about unweighted and weighted hists. My histograms’ creation are just what I said in the description only I saved them in a root file and then read them somewhere else due to some reason. Could you answer my other question about NDF?