Inconsistent Neyman chi2 definition for Poisson data between TH1::Chisquare and RooAbsReal::createChi2
Los mantenedores suelen responder en 1 día
@guitargeek ya está trabajando en esto.
Desde el 28/3/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Explain what you would like to see improved and how.
To evaluate the goodness of fit between a model and binned data, we can either use TH1::Chisquare with a TH1 histogram and a TF1 function, or use RooAbsReal::createChi2 with a RooAbsPdf pdf and a RooDataHist dataset. However, in the case of Neyman chi2 with Poisson data, the two uses different strategies when computing the variance of the data, TH1::Chisquare uses Wald approximation $\sqrt{n_{obs}}$ (FitUtil.cxx#352) whereas RooAbsReal::createChi2 uses the exact Poisson (Garwood) interval at 68.3% (RooChi2Var.cxx#157 and RooDataHist.cxx#1589).
Reproducer
import ROOT
import numpy as np
MU = 0.5
SIGMA = 0.1
SIZE = 100
ROOT.RooRandom.randomGenerator().SetSeed(2026)
x = ROOT.RooRealVar("x", "x", 0, 1)
x.setBins(20)
mu = ROOT.RooRealVar("mu", "mean", MU)
sigma = ROOT.RooRealVar("sigma", "width", SIGMA)
gauss = ROOT.RooGaussian("gauss", "gaussian PDF", x, mu, sigma)
data = gauss.generate(ROOT.RooArgSet(x), SIZE)
data_hist = data.binnedClone()
th1 = data_hist.createHistogram("h1", x)
f1 = ROOT.TF1("f1", "gaus", 0, 1)
f1.SetParameters(1, MU, SIGMA)
integral = f1.Integral(x.getMin(), x.getMax()) / th1.GetBinWidth(1)
f1.SetParameters(SIZE / integral, MU, SIGMA)
# Pearson chi2
pearson_chi2 = gauss.createChi2(
data_hist,
ROOT.RooFit.DataError(ROOT.RooAbsData.Expected),
ROOT.RooFit.Extended(False)
)
print(f"Pearson chi2 with RooAbsReal::createChi2 = {pearson_chi2.getVal()}")
print(f"Pearson chi2 with TH1::Chisquare = {th1.Chisquare(f1, 'p')}")
# Neyman chi2
neyman_chi2 = gauss.createChi2(
data_hist,
ROOT.RooFit.DataError(ROOT.RooAbsData.Poisson),
ROOT.RooFit.Extended(False)
)
print(f"Neyman chi2 with RooAbsReal::createChi2 = {neyman_chi2.getVal()}")
print(f"Neyman chi2 with TH1::Chisquare = {th1.Chisquare(f1, '')}")
Output
Pearson chi2 with RooAbsReal::createChi2 = 7.391492169139706
Pearson chi2 with TH1::Chisquare = 7.391492169139708
Neyman chi2 with RooAbsReal::createChi2 = 5.055198120851967
Neyman chi2 with TH1::Chisquare = 6.590759652852072
ROOT version
6.38.00
Installation method
conda
Operating system
Linux
Additional context
No response
- Lenguaje dominante
- C++
- Estrellas
- 3.3k
- Forks
- 1.6k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 188
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de root-project/root
-
thisroot.sh: wrong ROOTSYS in zsh when the shell's command line has a newlinePosiblemente ocupada @dpiparo la tomó hace 5 días. Abiertobug in:Build System
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
root-project/root#23746 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[tmva][sofie] Inputs of unsupported type (e.g. float16) give code that does not compile instead of an errorPosiblemente ocupada @lmoneta la tomó hace 14 días. AbiertoAI-Assisted bug in:SOFIE
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
root-project/root#23655 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[RDataFrame] Code that transforms `#var` alias to `R_rdf_sizeof_var` does not respect string literalsPosiblemente ocupada @vepadulano la tomó hace 2 días. Abiertobug in:RDataFrame
Dificultad 3/5 1-2 días Aptitud para principiantes 71/100
root-project/root#23790 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
TDataMember::GetOffset interfers to TDataMember::GetOffsetCintPosiblemente ocupada @pcanal la tomó hace 1 día. Abiertobug in:Core Libraries
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
root-project/root#23777 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`TChain::GetEntries` internal caching ineffective?Posiblemente ocupada @pcanal la tomó hace 7 días. Abiertoimprovement in:TTree
root-project/root#23738 · 6 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de root-project/root
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
OpenSpace/OpenSpace#4353 · 1 comentario ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
macOS: a double-click on a notarized altairsim is refused, and the docs give only the offline casePosiblemente ocupada @anhaoXie la tomó hoy. Abiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
mutationpp/Mutationpp#337 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
bulletphysics/bullet3#4819 ·