Inconsistent Neyman chi2 definition for Poisson data between TH1::Chisquare and RooAbsReal::createChi2
Maintainer thường phản hồi trong vòng 1 ngày
@guitargeek đang làm issue này rồi.
Từ ngày 28/3/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- C++
- Star
- 3.3k
- Fork
- 1.6k
- Merge trung bình
- 2 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 222
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của root-project/root
-
in:RooFit new feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
root-project/root#23985 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[PyROOT] Every ROOT.Math access leaks memory (failed cppyy.gbl lookup in the facade fallback is not cached)Có thể đã có người làm @guitargeek đã nhận 1 ngày trước. Đang mởbug in:Python Interface
root-project/root#23978 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A TTree with a friend TChain doesn't propagate all errors happening in the chainCó thể đã có người làm @vepadulano đã nhận 2 ngày trước. Đang mởin:TTree
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
root-project/root#23936 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Build] `fail-on-missing` contract not respected for `NOT http AND webgui`Có thể đã có người làm @guitargeek đã nhận 6 ngày trước. Đang mởbug in:Build System
root-project/root#23907 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Header cleanup campaignCó thể đã có người làm @hageboeck đã nhận 7 ngày trước. Đang mởimprovement in:Core Libraries
root-project/root#23880 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của root-project/root
Issue tương tự
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutCó thể đã có người làm @Spockkk0225 đã nhận hôm nay. Đang mởci
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
alibaba/neug#1195 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày
-
QA/No release-notes/exclude tests tests/missing-coverage tests/test-quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
brave/brave-browser#61019 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
? - Needs Triage bug CUTLASS C++
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 4 ngày