# How to determine if a parameter is near the limit

**URL:** <https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371>\
**Category:** ROOT\
**Created:** [October 22, 2021, 5:56pm UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371 "2021-10-22T17:56:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaubee](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ecb155/32.png) [@vaubee](https://root-forum.cern.ch/u/vaubee)\
**Post date:** [October 22, 2021, 5:56pm UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/1 "2021-10-22T17:56:04Z")

</div>

I’m trying to determine in a program whether a parameter is near the limit to warn the user about the fact that the error estimates might be unreliable. I use Minuit2 as a minimizer (via `ROOT::Math::MinimizerOptions::SetDefaultMinimizer("Minuit2", "Combination");`).

How can I check after a call to TH1::Fit whether any of the parameters is near the limit? Minuit used to output the ` **at limit** ` warning if a parameter was at the limit (unless the “q” option is used), but Minuit2 doesn’t do that anymore. Is there an easier way than to just loop through all parameters and comparing the value to the limits?

---

<div class="post-metadata">

**Author:** ![vaubee](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ecb155/32.png) [@vaubee](https://root-forum.cern.ch/u/vaubee)\
**Post date:** [October 22, 2021, 9:08pm UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/2 "2021-10-22T21:08:50Z")

</div>

I see that in a case where the error estimation fails the reported error on that parameter and the square root of that parameters diagonal element of covariance matrix don’t match. Is that a reliable test or is that just a something that **can** happen if the parameter is near its limits?

I tried checking the status of the fit result or if it is valid, but the status is always zero and the fit result claims to be valid (which I guess it is, since the parameter value is good, just not the parameters error estimate). I also tried checking if the parameter has a minos error which is not the case, but since I’m not using minos that’s not surprising.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [October 26, 2021, 8:45am UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/3 "2021-10-26T08:45:03Z")

</div>

I think @moneta can help you with this

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [October 26, 2021, 9:24am UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/4 "2021-10-26T09:24:16Z")

</div>

Hi,  
If you are fitting with option “V”, you should have in Minuit2 also a message indicating that the specific parameter is _“at upper limit”_.  
You are probably right, we should add this message also in the printed result, visible also when not using the verbose option and add a flag to indicate that the value in the covariance matrix is not reliable.  
In this case one should not use the parabolic approximation for errors but Minos, to determine correctly the lower (or upper) error estimate.

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![vaubee](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/ecb155/32.png) [@vaubee](https://root-forum.cern.ch/u/vaubee)\
**Post date:** [October 26, 2021, 4:22pm UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/5 "2021-10-26T16:22:34Z")

</div>

I didn’t know that I could use Minos in these cases, that is good to know thanks!

So in a program or script, there is no way to know if the parameter is at it’s limit unless I try and parse the output (using the “v” option)?

Or is the test of comparing the reported error of the parameter with the square root of the corresponding diagonal entry of the covariance matrix a good test?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [October 27, 2021, 8:45am UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/6 "2021-10-27T08:45:16Z")

</div>

Yes, Minos in this case should always report the correct error for the unlimited side…

I think in a program you can check if the parameter +/- error is larger/smaller than limit value. If it is the case then your parameter is close to the limit and I think the error estimate using the Hessian is not anymore reliable, and I would recommend using Minos in that case to estimate a better interval. However, when bounds are present better to use other methods to estimate the confidence intervals, and such tool exists for example in RooStats (see asymptotic estimation of upper limits).

I have checked that the message printed by Minuit is happening only when the parameter value is very close to the limit (within something like 10^-6). In that case you have always a big difference between estimated error and sqrt(covariance matrix element).  
At the limit is expected that the corresponding covariance matrix element will be close to zero due to the vanishing gradient of the transformation.

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [November 10, 2021, 8:46am UTC](https://root-forum.cern.ch/t/how-to-determine-if-a-parameter-is-near-the-limit/47371/7 "2021-11-10T08:46:12Z")

</div>

Closed on November 10, 2021, 8:46am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
