Can't believe the goodness of my fit

This is a fit of my model(2 gaussian + exp) to the histogram.

and as a result the value of chisq/ndof I am getting is pretty close to 1.

Can I believe this fit result and be Happy :upside_down_face:.
PS; If you look at the fit some data points near the mean are not lying on the pdf, but still I am getting this much good reduced ChiSq value?!
Please enlighten me :pray:.

also somewhere in the output-

roomodel.cpp (2.3 KB)


I think you have a lots of bins with little statistics or are empty. The chi-square makes sense only of you have at least 5 entries per bin, otherwise it will be biased. Try rebinning your data and re-compute the chi-square. One other thing to try is to compute the likelihood ratio as suggested by Baker-Cousins (see for example ).


1 Like

@moneta Maybe you could create a dedicated web page with a collection of all papers relevant to statistics and other numerical methods used in ROOT.

May be a new section in: Topical Manuals - ROOT

As for the error that you see, it’s because your are doing an extended fit with the Extended() command with a model that doesn’t encode any number of events.

An extended fit is a fit where also the total number of expected events is a free parameter. Here is a tutorial on how that works in RooFit:

In particular, this definition of the RooAddPdf is similar to the code in your script:

   // Sum the composite signal and background into an extended pdf nsig*sig+nbkg*bkg
   RooRealVar nsig("nsig", "number of signal events", 500, 0., 10000);
   RooRealVar nbkg("nbkg", "number of background events", 500, 0, 10000);
   RooAddPdf model("model", "(g1+g2)+a", RooArgList(bkg, sig), RooArgList(nbkg, nsig));

So to be able to do extended fits, the coefficients of the RooAddPdf should be expected number of events, and not fractions below one.

Alternatively, you can simply remove the Extended() command in fitTo() to not do an extended fit. Depends on your usecase.

1 Like

Thank You so much guys, This is much clearer now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.