Negative log likelihood using root fitter and combinedFit.C

Hello Rooters,
I am trying to fit my data (combinedFit.C) and estimate the parameters using negative log-likelihood. The code runs but without finding the minimum values.
Before this I used the Chi-square and it worked fine.

Can you guys help me out with performing the negative log-likelihood ?

I attach a simple code which reads the text file and performs either chi-square [commented] or negative log likelihood (PoissonLLFunction).

data.txt (2.7 KB)
rate_fit.C (5.8 KB)

Thank you

Cheers!

I think @moneta can help.

1 Like

Hi,
your code works if using Minuit instead of Minuit2 and
fitter.Config().ParSettings(0).SetLimits(30,70);

1 Like

Hi,
You are right, Thank you. It works with Minuit.
The only problem that I have now is that the error bars are very high on each parameter. Do you know how to can reduce the error bars? I can try changing parameters to different values.

Errors of parameters are okey for the chi^2 fit, but are too big for
the likelihood fit. Maybe the ROOT experts know the reason.
In any case Iā€™d recommend to redefine your fit functions like this

TF1 *fexp1 = new TF1("fexp1", "[2]/86400.*exp(-x/[0])+[1]", 23,123);
TF1 *fexp2 = new TF1("fexp2", "[2]/86400.*exp(-x/[0])+[1]", 23,123);
1 Like