In the source code for computing the Poisson interval (used in histograms I believe). First there is a hard-coded threshold of n = 100 where the asymptotic approximation is used (which was not explained clearly in the documentation as well as where the formula come from). The formula seems to be only valid if nSigma=1 (https://root.cern.ch/doc/v626/RooHistError_8cxx_source.html#l00112):
// use assymptotic error if possible
if(n > 100) {
mu1= n - sqrt(n+0.25) + 0.5;
mu2= n + sqrt(n+0.25) + 0.5;
return kTRUE;
}
I believe the formula is derived by inverting the Score Test for the Poisson distribution. The general formula is probabaly:
$$n + \dfrac{Z^2}{2} \pm Z \sqrt{n +\dfrac{Z^2}{4}}$$
>> import ctypes
>> import ROOT
>>
>> inst = ROOT.RooHistError.instance()
>> ym = ctypes.c_double()
>> yp = ctypes.c_double()
>> nSigma = 3
>> n_list = [100, 101]
>> errlo = {}
>> errhi = {}
>> for nSigma in [1, 2, 3]:
>> print(f'{nSigma} Sigma')
>> errlo = []
>> errhi = []
>> for n in [100, 101]:
>> inst.getPoissonInterval(n, ym, yp, nSigma)
>> errlo.append(n - ym.value)
>> errhi.append(yp.value - n)
>> print('ErrorLo [N = 100, N = 101] : ', errlo)
>> print('ErrorHi [N = 100, N = 101] : ', errhi)
1 Sigma
ErrorLo [N = 100, N = 101] : [9.983254822886579, 9.56230589874906]
ErrorHi [N = 100, N = 101] : [11.033360941149681, 10.56230589874906]
2 Sigma
ErrorLo [N = 100, N = 101] : [18.98411465660803, 9.56230589874906]
ErrorHi [N = 100, N = 101] : [22.082468714289504, 10.56230589874906]
3 Sigma
ErrorLo [N = 100, N = 101] : [27.35378945919335, 9.56230589874906]
ErrorHi [N = 100, N = 101] : [33.829521810749526, 10.56230589874906]
Check duplicate issues.
Description
In the source code for computing the Poisson interval (used in histograms I believe). First there is a hard-coded threshold of
n = 100where the asymptotic approximation is used (which was not explained clearly in the documentation as well as where the formula come from). The formula seems to be only valid ifnSigma=1(https://root.cern.ch/doc/v626/RooHistError_8cxx_source.html#l00112):I believe the formula is derived by inverting the Score Test for the Poisson distribution. The general formula is probabaly:
$$n + \dfrac{Z^2}{2} \pm Z \sqrt{n +\dfrac{Z^2}{4}}$$
Reproducer
ROOT version
6.38.00
Installation method
conda
Operating system
Linux
Additional context
No response