Reasons for InvalidFitResult in MIGRAD

Hello, I have a user defined fit-function that I am fitting data to. When I fit my data to it I get the error message:

****************************************
         Invalid FitResult  (status = 4 )
****************************************

However, all other aspects of the fit appear to be successful (chi2/ndf ~ 1, reasonable parameter values and errors). I tried increasing the maximum number of functin calls, but this has no effect.

ROOT::Math::MinimizerOptions::SetDefaultMaxFunctionCalls(10E30);            
ROOT::Math::MinimizerOptions::SetDefaultMaxIterations(10E30);

I did manage to avoid this error message by adjusting the default precision, but I am hoping for a more stable solution as this does not always work.

 ROOT::Math::MinimizerOptions::SetDefaultPrecision(1E-9);

So basically, does anyone have any other ideas as to why ROOT/MIGRAD would give me this message when as far as I can tell, the fit looks good?

(I’d be happy to ignore this error except that I would like access to the TFitResultPtr…)

Thanks in advance for you help, it is much appreciated.

Hi,

The reason of the failure could be that the required tolerance is not reached. If you increase the print level
(e.g. ROOT::Math::MinimizerOptions::SetDefaultPrintLevel(1); or higher value) you might get the reason.
Normally this is caused by numerical problems given by the function provided by the user. It is better to try to fix this.
Another potential problem is that you are using parameters which are very correlated. You can try to look at the correlation matrix.

Before changing the precision, it is better eventually to increase the tolerance using ROOT::Math::MinimizerOptions::SetDefaultTolerance or to try to change the strategy to zero
ROOT::Math::MinimizerOptions::SetDefaultStrategy(0). With default strategy the covariance matrix is not computed at the end of the minimization, but an approximation is used.

Best Regards

Lorenzo

Hi Lorenzo,

to bad this forum doesn’t have upvotes. I never knew about these features (the tutorials seem to only mention them in the RooStats part), but I think they are extremely useful for everyday use cases.

I know that writing blog posts takes a lot of time with an uncertain return, but at least I would love to see more small bits about the hidden gems in ROOT::Math. There is so much useful (nicely decoupled) functionality in there that without some guidance even more documentation in the source wouldn’t help much (at least me).

Thanks for your thoughtful reply, I concur about the need for upvotes.