Hi everybody,

I have a problem with the chi2 test for the fit of one of my functions.

I have read in previous topics that there is a lot of ambiguity regarding the RooFit test required.

I then requested both “chi2/ndof” and “chi2” to evaluate if the two matched.

I calculate the degrees of freedom as: “# of bins in the histogram - # of parameters in the pdf”.

```
RooChi2Var chi_2("chi_2", "chi_2", model,dh,DataError(RooAbsData::Poisson));
cout << chi_2.getVal() << endl ;
Double_t chi2 = frame->chiSquare(7);
cout<<chi2<<"\n";
```

I decided to verify that the result did not depend deeply on the number of bins, varying them in a “for” loop and printing the results in a file.txt.

This is what appears in the files new example.txt (416 Bytes)

While the chi2 (in the first column) divided by the ndof (in the third column) give acceptable results, the chi2 / ndof (in the second column) varies a lot and, it would seem random.

What could this be due to?