I’d like to do the goodness-of-fit test for the un-binned maximum likelihood method. It seems to me that the chi2() test is well accepted. The problem is that for such test each bin of the histogram should have at least several entries. So an adaptive binning would be very helpful here. Is there one in ROOT (or RooFit)? Or is there a smarter way to do the goodness-of-fit test for the un-binned maximum likelihood method?

I should say sorry for my poor English. I read Ttree::UnbinnedFit, but I failed to find the answer there.

What I wanted to do is the goodness-of-fit test after the un-binned maximum likelihood fitting. I mean, the fitResult is 0. But we need stronger evidence that the fitting results describe the data correctly. In the past, one did the toy MC study after the fitting to check that the NLL value of the real data is covered in the range of NLL of the toy MC study. But it is argued that the NLL value is not a good criteria.

So I just return to the chi2() test. For such case, we need to bin the data such that each bin has at least 10 entries, or more, right? So I was just wondering whether there is an adaptive binning method implemented in ROOT, or even more, if one also provides the function (PDF), it could give a meaningful chi2 value and the probability?