Extracting Maximum Likelihood from a Fit

I am fitting two different user-defined functions (TF1 *f & *g) seperately to a histogram (TH1F *h) using the likelihood method: h->Fit(“f (or g)”, “L”);

The fits converge and everything is good, but my ultimate goal is to perform a likelihood ratio test between the two models that the functions describe. Is there a simple way to extract the maximum likelihood of each model from the fit results?


You can get the likelihood value from the TFitResult object which is obtained when using option “S”.
Here is the code example:

TFitResultPtr r = h->Fit( f, "L S");
double likelihood_value = r->MinFcnValue(); 

Best Regards



I am concerned by the name “MinFcnValue”. The likelihood should be a maximum. Is the term “min” used because r->MinFcnValue() may return chi2 (a minimum) or likelihood depending on the fit option?

(I just want to make sure I’m getting the right number.)