Hi @StephanH,
Thanks a lot for your reply.
So here is what I get from those two methods:
RooChi2Var chi2 ("chi2", "chi2", *model,datah,DataError(RooAbsData::Poisson)) : 24.94
frame->chiSquare(fun_name,"data",nfloparam): 0.4834
My original data is RooDataSet “data”, I created RooDataHist “datah” in order to call RooChi2Var.
I have 120 bins in my RooDataHist (set in RooDataSet and confirmed by datah.numEntries()) and nfloparam = 2. I also specified the binning when doing data.plotOn with the same range used in datah, so I am not sure if “The Chi2Var … and it does that in bins of the observable(s), which don’t necessarily coincide with the plot bins.” is the case…
If so, chi2/ndof given by RooChi2Var would be 24.94/(120-2)=0.21, which deviates a lot from 0.48.
As for the 0-bins treatment, does RooChi2Var also skip bins with 0 model predicted value? What would be the threshold for model prediction to be considered as 0? (I looked and the minimum predicted is like 0.001 entries)
I tried to do the fitting as well as chi2 calculation again in a range where all bins have non-zero entries and model prediction is larger than 1. This time: nbins = 30, # of param = 2, and I got:
RooChi2Var chi2 ("chi2", "chi2", *model,datah,DataError(RooAbsData::Poisson)) : 24.876
frame->chiSquare(fun_name,"data",nfloparam): 0.8805
This time those results are close as 24.876/(30-2)=0.888 but they still differ.
I think there may be some much deeper things going on, and really look forward your suggestions!
Thanks a lot!
Best,
Sebastian