Errordef value when using iMinuit as minimiser #2517
-
Hello experts, I just wondered if in a scenario of a binned maximum likelihood fit with Pragmatically, I was wondering whether I should use this snippet at the start of my fitting code: pyhf.set_backend(
# https://scikit-hep.org/pyhf/_generated/pyhf.optimize.opt_minuit.minuit_optimizer.html
# 0.5 errordef for NLL
"numpy",
pyhf.optimize.minuit_optimizer(verbose=1, errordef=0.5),
) # get uncertainties and covariance
pyhf_fit_result, result_obj = pyhf.infer.mle.fit(
data, pdf, return_result_obj=True, return_uncertainties=True
) to extract the correct error estimate. I have seen related differences in other discussions, but I thought it useful to confirm this once and for all. Thanks a lot in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, this relates back to #1006. Currently Lines 132 to 134 in e8789a2 With this definition, pyhf/src/pyhf/optimize/opt_minuit.py Line 41 in e8789a2 There is no need to manually change |
Beta Was this translation helpful? Give feedback.
Hi, this relates back to #1006. Currently
pyhf
uses 2*NLL as objective function to minimize:pyhf/src/pyhf/infer/mle.py
Lines 132 to 134 in e8789a2
With this definition,
errordef=1
is the correct thing to use, which is whatpyhf
does internally as well:pyhf/src/pyhf/optimize/opt_minuit.py
Line 41 in e8789a2
There is no need to manually change
errordef
. Ifpyhf
changes to the NLL as objective, theerrordef
would have to also be changed at the same time. If you run the fit externally, the right value depends on what…