-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AsymptoticCalculator.teststatistic
issues warning and returns nan
when qmuA == 0
#1992
Comments
I guess this is actually probably an updated and more specific version of #529. So it looks like it can also occur for non-zero POI values if the raw signal yield is small enough. The |
Looking at the docs, it seems Since this is |
The docs don't actually match equation (16) in the paper, where the first line is |
Actually, the code matches the paper, but the docs don't match the code pyhf/src/pyhf/infer/test_statistics.py Lines 30 to 32 in cbd68c8
|
* Guard against nan from division by zero in pyhf.infer.calculators.AsymptoticCalculator.teststatistic. * Add use of 'less than or equal to' to docs for tests stats to match equations 14 and 16 of https://arxiv.org/abs/1007.1727. * Add tests to ensure that nan conditions in Issue #529 and Issue #1992 are not possible.
Summary
When
poi_test == 0
,pyhf.infer.calculators.AsymptoticCalculator.teststatistic
often issues a warning and returnsnan
because of a division by zero on this line:pyhf/src/pyhf/infer/calculators.py
Line 418 in cbd68c8
This would disappear by changing
<
to<=
on this line:pyhf/src/pyhf/infer/calculators.py
Line 422 in cbd68c8
As far as I can tell, there's no reason not to make this change. These lines only get run for$\tilde{q}_{\mu, \textrm{A}} = 0$ should be when $\mu = 0$ . By definition, $\tilde{q}_\mu$ is always 0 for this case, and
test_stat == 'qtilde'
, and the only time_true_case
would cover this:pyhf/src/pyhf/infer/calculators.py
Lines 411 to 413 in cbd68c8
It's actually interesting that this issue doesn't always occur for
poi_test == 0
. I think that's only because of small but non-zero errors in fitting to the generated Asimov data before calculatingqmuA
. This issue has been present for years--I think since version0.1.1
or so.OS / Environment
Steps to Reproduce
File Upload (optional)
No response
Expected Results
I would expect$\tilde{q}_\mu$ (regardless of normalization factors).
pyhf.infer.test_statistics.qmu_tilde
andpyhf.infer.calculators.AsymptoticCalculator.teststatistic
to both return 0, the correct value ofActual Results
pyhf Version
Code of Conduct
The text was updated successfully, but these errors were encountered: