Rootfit and root fit differnet results

Hi I am fitting the same histogram with unbinned likelihood with roofit and binned likelihood using TF1
and I am getting different results… I have been using roofit for a few months and I have doubled checked before that it does consistently agree with root fit.
I attached both images for root fit and roofit. Lambda and Lambda1 is the same parameter.

[root fit ][/c1.png]

I also do see another behavior which sometimes the root fit seems to be at limit and does not converge while the roofit fit converges!! both giving different results!!

Does anyone know conditions under which this happens?

It is hard to say with the information you provide, but it really seems you are not controlling what is happening in your fit. A suggestion to kick-off the debugging could be to use the histogram you display via a RooDataHist in RooFit and check the result (the roofit code should transparently work with a binned and unbinned dataset).

Yes, I was not looking at the same thing. Wish explain the large discrepancy.
However, The below plots show the binned likelihood with roofit and rootfit.
One thing I still don’t understand is why the errors on lambda is different. Any ideas?


Are you minimising a negative log likelihood in the two cases?Is the fit range and the initial values of the parameter identical?

I doubled check and the range and the initial value is the same in both cases.
I am fitting with roofit using the following lines
RooGenericPdf genpdf( “Func.” );
genpdf.fitTo(data, Save(kTrue), Range(“range”))

and with Root fit using TF1

Where h1 is a hist. within the “range”

I did it in two lines because it would not take “BLL” option .


These are two log likelihood minimisations.
It is normal to see different results for parameters as for an unbinned and binned fit. In the former case for example, each measurement enters the likelihood weighted by its own errors. In the latter the values are lumped together (that is indeed the goal of a data reduction technique like histogramming).
Use as explained before the RooDataHist and perform a binned fit, for various sizes of the bins.

Hi dpiparo,

Something is not clear to me.

In the last case I posted I used binned RooFit and binned root fit
in which case I received two different errors. Now just for this case
using same range and same initial lambda you say it is OK to have
different errors!? Do you know why that happens.