Remove bins in chi2test calculation


I’m running a code in several root files from folders and gets the chi square test of independence between a reference and the histograms in some loop for this folders. To do this, i use the function:

chi21th1p=h2.Chi2Test(h1, "UU")

in the output, i receive this:

The TH1F histogram has a bin with a less 1 event

and the p-value of the test is: p-value=0 (no sense)

how can i avoid bin with less 1 event in the calculation of the chi test square independence?

there are a lot histograms with the same issue…what about the histogram is empty? how can avoid a empty histogram?
the code is with pyroot but any language is ok.
thanks in advance

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi @sergio_fernandez,

Could you please attach a minimal reproducer of your issue? After that maybe @couet can help, but we are lacking context now.

I’m not sure I understood your last two questions. Could you elaborate a bit more?


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.