Hi All,
My co-worker and I, using different tools, were trying to fit some histograms. Surprisingly, we found the chi2 of our results were different by 1.5 to 2 times. Here is a toy histogram for example:
Bin centres: [0.025, 0.075, 0.125, 0.175, 0.225, 0.275, 0.325, 0.375, 0.425, 0.475, 0.525, 0.575, 0.625, 0.675, 0.725, 0.775, 0.825, 0.875, 0.925, 0.975]
Bin edges: [0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.]
Bin heights: [0, 0, 0, 0, 0, 1, 3, 16, 17, 14, 18, 18, 7, 5, 1, 0, 0, 0, 0, 0]
ROOT, as well as the other tool, gave a similar fitting result as
f(x) = 19.0521 * exp(-(x-0.497859)^2 / (2*0.0980641^2))
ROOT’s TF1()
somehow gave a chi2 of 7.27082, while the other one (and a hand calculation) gave
chi2 = \sum{(f(bin_centre_i) - bin_height_i)^2 / bin_height_i} = 12.9570
for those bins with non-zero heights, of course.
I checked the manual and could not find the definition of chi-square in ROOT (but in RooFit package). And I also found a discussion about different chi-square definitions in this forum and it led to a closed issue. But unfortunately, the author seems to have deleted the original comments.
Can anyone enlighten me, for instance, where can I find the definition in ROOT manual or even the codes?
Many Thanks,
Yamabuki
ROOT Version: 6.26/04