Hi, I was trying to implement my own version of FCN and wanted to cross-check my code with the ROOT implementation.
Assuming that I have managed to find the correct place (is this method FitUtil::EvaluatePoissonLogL in math/mathcore/src/FitUtil.cxx ?) I noticed that ROOT uses the following definition:
with y -> data(i), fval -> theory(i)
whereas I would have expected something like
(see Baker-Cousins, NIM 221 (1984) 437-442)
Could the experts please comment? Am I looking at the wrong place? are these two different things?
the first one is the simple log-likelihood function of the bins assuming Poisson statistics ( L_p (y:n) using the Baker-Cousins notation).
Note also that the constant terms (not depending on the parameters) have been dropped.
The second one is the likelihood ratio lambda_p = L_p(y:n)/ L_p(n:n)
The difference is in the normalization, but minimizing one or the other you will get the identical results. This is also written in the cited paper.
If you want the advantage of the likelihood ratio is that -2 * log(lambda) is distributed asymptotically as a chi-square distribution.
Probably, for this reason we could maybe change the code to use the likelihood ratio lambda.
Thanks for your message and the explanation.
Yes, my motivation was to get a “proper” chi2 distribution, in order to test the robustness of the fit and make sure I get a flat probability distribution for a large number of pseudo-experiments.
I have indeed confirmed that my custom implementation and ROOT’s built in log-likelihood function give the same minimization results.