This might be more of a stat question than related to ROOT. I know that the Poisson interval of 0 events is probably ill-defined, but in case we need to plot the data with error bars, we might sometimes need to show the error bar for bins with 0 events (alternatively we could just hide that data point).
From the RooHistError
class, we get (lower, upper) interval of (0.0, 1.1478744644493182)
import ctypes
import ROOT
lower, upper = ctypes.c_double(), ctypes.c_double()
nevent = 0
nsigma = 1
HistError = ROOT.RooHistError.instance()
HistError.getPoissonInterval(nevent, lower, upper, nsigma)
print(lower.value, upper.value)
However, with the explicit formula from Poisson errors for RooHist - #8 by moneta, we get (lower, upper) interval of (0.0, 1.8410216450092634)
import ROOT
import numpy as np
nevent = 0
nsigma = 1
beta = ROOT.Math.erf(nsigma / np.sqrt(2.0))
alpha = (1 - beta)
lower = ROOT.Math.gamma_quantile(alpha / 2., nevent , 1.0)
upper = ROOT.Math.gamma_quantile_c(alpha / 2., nevent + 1, 1.0)
print(lower, upper)
So which one should be preferred? Or neither of them? What should be the expected behavior?
Regards,
Alkaid