Compare likelihood from two fits with offset enabled

Dear expert,
This might be a dummy question,
Let’s say i am fitting the same data, with different initial values and different configuration of sharing parameters.

What i would like to do is to make a comparison of N fits likelihood minimum value to the nominal one i have. In order to improve stability of my complex fit i do the Offset() on the likelihoods before actually minimizing things.
My question is if having this prevent a proper comparison or not and whether i need the setHideOffset on whatever LL i create.

Thanks
Renato

My question stem from the fact that in our fit which has 390 parameters , and uses a complex model , external gauss constraints and create the likelihood for 24 datasets simultaneously, what i noticed is that the likelihood created has on 6/24 datasets a LL value of 1e+7 and in general we initialize the parameters pretty close to the expected convergence point.

With/without offsets the fit converge and give a correct covariance , while without it still converge but the covariance quality is not good.

Therefore, i would like to configure my fit to always do the offsetting , but be still able , regardless of the initial value i set likelihoods from different fits.

Hi @RENATO_QUAGLIANI ,
we need @moneta 's help, let’s ping him.

Cheers,
Enrico

1 Like

Hi,

For each fit you should be able to get the offset and then use it to correct the obtained FCN. The offset can be retrieved from the RooMinimizerFCN class, see
https://root.cern.ch/doc/master/classRooAbsMinimizerFcn.html#aaa7e3b77280fdbeb95ed5a98aa604673
and a pointer to that class can be obtained from RooMinmizer::getMultiGenFunction after having done a dynamic cast to the right type.

Cheers

Lorenzo

Thanks a lot @moneta , i am testing it and report back, but i am not sure

ROOT::Math::IMultiGenFunction * 	getFitterMultiGenFcn () const
 
ROOT::Math::IMultiGenFunction * 	getMultiGenFcn () const

i see those 2 calls in the RooMinimizer…
I wonder, what is the call you are referring to ?

@moneta
To be clear, in my code i have this

//Create a sum of Log(Likelihood terms) 
    RooAddition _nllSimultaneous("nllCombined", "-log(likelihood)", _nLL);
//enable offsetting
    _nllSimultaneous.enableOffsetting(m_offsetLikelihood);
//Create the RooMinmizer instance
    RooMinimizer _minimizer(_nllSimultaneous);
//Configure the fit
    ConfigureMinimizer(_minimizer, m_name + "_Fit.log");
//Run the fit 
    FittingProcedure(_minimizer, &_nllSimultaneous);

At which stage do i need to

auto fcn = dynamic_cast<RooAddition>( _minimizer.getMultiGenFcn()); 
offset = fcn-> getOffset(); 

?

Hi,
Actually I think if you call after the minimisation _nllSimultaneous.getVal() you will get the nll value without the offset

Lorenzo

1 Like

Yes @moneta
That’s what i concluded as well, to getVal before actually running the fit to have the offset value the fitter use, why would i need the getVal after? Maybe i miss something.
Ah i see you think that the offsetted value is something the fitresults know about but the original nLL object keeps it without offset?

Hi,
I guess you wanted to compare the nLL values of two fits, i.e. the value on the same data set with same model, but different parameter values. For this you can call nLL->getVal() after the fits. The return value should be re-correct re-adding the internal offset (if used).

Lorenzo

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