# Chi2 interpretation in Log Likelihood fits

Hi folks,

is there any goodness-of-fit value if I do a binned log-likelihood fit of a histo like the chi2 in chi2-fits?
And can you explain to me the interpretation of the chi2/nof value after such a log-likelihood fit?
Maybe somebody has already raised this question, but I didn’t find the topic…

Thanks,
Uli

Hi,

after a binned log-likelihood fit you can estimate the chi2 from the bins and the fitted function. That is the values that is printed in the statistics box.
Notice, the different behavior for the empty bins, they are excluded from the chi2 fit while are used in the likelihood fit. If you have many empty bins, the chi2 will not then be a meaningful goodnes-of-fit test.

Best Regards

Lorenzo

How would one get the log-likelihood value?

Hi,

You can get the log-likelihood value from the fit result. Do for example:

``````TFitResultPtr r = h1->Fit( function, "L S");   // use option L for likelihood fit and S for getting the fit result
double nLogL = r->MinFcnValue();``````

Lorenzo

Is there another way without using the TFitResultPtr? Any method in TVirtualFitter?

I should clarify that I am trying to map out the log likelihood value as a function of a certain fit parameter. What I was thinking was to fix all parameters and vary the parameter of interest and get the log-likelihood value, but when all the parameters are fixed the return value for MinFcnValue is always 0. Is there a better method to accomplish this?

Any suggestions on how to calculate the log-likelihood value for a fit with all parameters fixed?

Hi,

You should be able to get the likelihood value by fixing all parameters when using the ROOT trunk or the latest version, 5.34.04.
In case of older versions, you might able to get the value if using Minuit2
(call ROOT::Math::MinimizerOptions::setDefaultMinimizer(“Minuit2”) before TH1::Fit)

Best Regards

Lorenzo