Hi ,
is there a simple way to find out whether one or more fit parameters hit the limit after fitting e.g. a TF1 to a graph or histogram?
Best,
Klaus
ROOT Version: v6-24-04
Platform: Linux
Compiler: Not Provided
Hi ,
is there a simple way to find out whether one or more fit parameters hit the limit after fitting e.g. a TF1 to a graph or histogram?
Best,
Klaus
ROOT Version: v6-24-04
Platform: Linux
Compiler: Not Provided
Hi Klaus!
Well, “simple” I don’t know but this:
TH1F h("h", "hist", 10, 0., 1.);
h.Fill(0.1, 1000);
TF1 f("f", "pol0", 0., 1.);
f.SetParLimits(0, .2, .3);
f.SetParameter(0, .25);
auto r = h.Fit(&f, "LS");
double low, up;
r->ParameterBounds(0, low, up);
bool atLimit = TMath::AreEqualRel(r->Parameter(0), low, 0.01) || TMath::AreEqualRel(r->Parameter(0), up, 0.01);
might work?
(Btw the return value of ParameterBounds gets fixed by [mathcore] Fix return of FitResult::ParameterBounds as doc says. by Axel-Naumann · Pull Request #13305 · root-project/root · GitHub )
…and I find this a good question and maybe it’d be nice to transport the minimizer info that a param has hit the limit to the FitResult. @moneta what do you think?
Hi Alex,
thanks, I indeed currently use something like this in a helper function. It just came to my mind that parameters of interest hitting the limit might be invalid measurements, therefore one needs to take care. I imagine a function like
bool TF1::IsParAtLimit(int parnum)
or so to check this for individual parameters might be useful.
Best,
Klaus