Inconsistent output for TH1::Fit with Log-likelihood

The output of uncertainties obtained with a log=likelihood fit (option “VWLE”) are somewhat inconsistent (if the histogram has been re-scaled).
Using root version 5.34.01 with the following minimal example.

void TestFit() { TH1D hGaus("hGaus","hgaus", 100, -5, 5); hGaus.Sumw2(); hGaus.FillRandom("gaus",10000); hGaus.Scale(0.01); TFitResultPtr resPtr = hGaus.Fit("gaus","VWLES"); TFitResult *res = resPtr.Get(); for (int i = 0; i <3 ;++i) { std::cout << res->Parameter(i) << " - " << res->LowerError(i) << " + " << res->UpperError(i) << std::endl; } }

If the histogram is scaled before the fit, the fit outputs three different uncertainties.
One after Migrad is done and Hesse has been run

FCN=0.422288 FROM HESSE STATUS=OK 16 CALLS 70 TOTAL EDM=1.38199e-08 STRATEGY= 1 ERROR MATRIX ACCURATE EXT PARAMETER INTERNAL INTERNAL NO. NAME VALUE ERROR STEP SIZE VALUE 1 Constant 3.97058e+00 4.86312e-01 5.26493e-05 3.97058e+00 2 Mean 8.63014e-03 1.00477e-01 1.33245e-05 8.63014e-03 3 Sigma 1.00476e+00 7.10483e-02 2.55226e-06 -9.27293e-01

Edit:
After Minos was done, Hesse again:

FCN=0.120438 FROM HESSE STATUS=OK 22 CALLS 23 TOTAL EDM=2.8871e-05 STRATEGY= 1 ERROR MATRIX ACCURATE EXT PARAMETER INTERNAL INTERNAL NO. NAME VALUE ERROR STEP SIZE VALUE 1 Constant 3.97058e+00 4.88173e+00 4.86312e-02 3.97058e+00 2 Mean 8.63014e-03 1.00859e+00 1.75530e-02 8.63014e-03 3 Sigma 1.00476e+00 7.16343e-01 3.39655e-03 -9.27293e-01

And the standard output from the fit, also shown without option “V”

**************************************** Minimizer is Minuit / Migrad MinFCN = 0.422288 Chi2 = 59.1487 NDf = 97 Edm = 1.38199e-08 NCalls = 70 Constant = 3.97058 +/- 0.0484528 Mean = 0.00863014 +/- 0.0100107 Sigma = 1.00476 +/- 0.00698139 (limited)

Three different errors, all a factor 10 different. I don’t understand where the difference is coming from.

If the histogram is not rescaled all the uncertainties reported are the same size. If not using log-likelihood all the uncertainties are also the same.

Hi,

When using a weighted likelihood, one cannot use Minos. The Minos algorithm does not work in this case. I am not sure if it can be adapted to this case. For the time being, I will fix this by avoid to run incompatible options and print an error message.

Thank you for reporting this issue,

Lorenzo

Hello Lorenzo,

Yes, signalling an error for inconsistent options would be good.

What about the uncertainties reported by Migrad or Hesse? Do they also not work for the likelihood fit?

Thanks,
Andre

Hi,

I have fixed now in the trunk and in the 5.34 patches the fitting to avoid computing the Minos error when doing a weighted likelihood fit.
The error from Hesse should be fine. The only think that you should look just at the final output from FitResult, the intermediate values printed by Minuit do not corresponds to the real error. This is because the final is computed by calling two times Hesse, the first time on the weighted likelihood and the second time on the likelihood built using the weight square.

Best Regards

Lorenzo

Thank you for the fix and explanation
Andre