Fixing the FrequentistCalculator module #178
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried the FrequentistCalculator for limit setting with this nice library, but unfortunately found it creating quite weird results, as also reported in #175.
So yesterday I threw myself at it and managed to get a working version with some tweaks.
It may not be most elegant python nor do I have the overview whether this fix is not breaking another use case. But it seems to work for me. I attach the script I use for testing (effectively adapted from https://github.com/scikit-hep/hepstats/blob/main/notebooks/hypotests/upperlimit_freq_zfit.ipynb):
demo_example.zip
The fix addresses several points:
the change in the$\mu$ , while poialt is denoted with $\mu^\prime$
frequentist_calculator
module: it's actually a fix on the theory level: to get the poinull test statistic distribution, you will want to evaluate the test statistic at the same point at which you generate (this is different for poialt). In https://arxiv.org/pdf/1007.1727 poinull is denoted asthe change on the other files have the following aim:
The observation was that the toys thrown were always the same and corresponding to the original fit result given to the calculator. This is wrong. One wants the toys to correspond to the profile fit at the poigen value. So I had to
a) set the starting parameters instead of the bestfit to the profile fit at the poigen value
b) request that the distribution is thrown from a new loss every time
I put some plots up here, made with the demo example that I attached, which demonstrate that the fix works.
clscurves.pdf
massfit.pdf
q-distributions.pdf