About how to tell the goodness of fitting by CHI2/NDF

Hi all RooFit expoerts,

Now I am trying to fit the sidebands of data by using different polynomial functions. And I use the following codes to print out the chiSquare/degree of freedom,

RooArgSet *floatpar1 = pdf1.getParameters(dh);
int Npars1 = (floatpar1->selectByAttrib(“Constant”,kFALSE))->getSize();
cout << “parameters size: " << Npars1 <<” chi^2 = " << frame->chiSquare(“totalPDF1”,“data”,Npars1) << endl;

So now the best way to compare the goodness of fittings of different functions is to see how close is the “printout frame->chiSquare” value to 1, am I understanding it right?
Besides, I guess the p-value might also help to tell the goodness, but I am still not sure how to get the p-value of corresponding fitting, anyone know how to do it?

Thank you!


I am not sure I have understood correctly your questions. From this he chisquare value and the number of degree of freedom you can get the p-value for the fit given your function.
To compare different function, one thing you can do is a F-test



Dear Moneta,

Got it. And as for the p-value, I have tried to print out the verbose fitting result, but it seems that it doesn’t include the p-value.

RooFitResult* fitresult = pdf1.fitTo(dh,Minos(kTRUE),Range(fitrange),Strategy(2),Save(kTRUE),Timer(kTRUE));
//TString stat = gMinuit->fCstatu;
//cout << "Minuit: " << stat << endl;

Is there other way to obtain the p-value of the fitting?

Thank you!

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