Dear experts,
I would like do unbinned extended maximum likelihood fit (Simultaneous data and MC fit), with external constrains. For the nominal case i.e., without constrains, we construct the likelihood using:
method1 (RooNLLVar) then call the minuit2minimizer
. But since ExternalConstraint isn’t possible using RooNLLVar, I’ve switched to:
method2 (createNLL) then call the same minuit2minimizer
,
assuming that method1 and method2 will give similar results without any external constraint. However, I do have very different results between 1 and 2. Moreover, In method 2, I got many warnings (p.d.f normalization integral is zero or negative), and also a problem with normalization when calling plotOn method, although the fit has converged at the end. I am also pretty sure that I have passed the same options for both methods. Additionally, using
method3 (fitTo)
for the same problem, I got no convergence.
I did similar comparison for a RooFit example (rf501_simultaneouspdf.C), as in the attachment, where I changed the model to be extended and added the three different fit methods for comparison. I got very tiny differences in the results as shown in the attached “output”.
Are the differences expected? or should they be identical to the last digit? Would theses differences get magnified if I have more complex models? since in my actual code I have e.g. Johnson S_u, Fermi-DiraC, Crystal Ball …etc and many fit components.
For your info, in my real code, I call the three methods as follows:
method1:
RooNLLVar nll("nll", "", *m_simul, *m_comb_data, extend, range, cpu);
method2:
RooAbsReal* nll = m_simul->createNLL(*m_comb_data, extend, range, cpu);
common to method1 and 2
RooMinimizer min(nll); min.optimizeConst(true); min.setMaxIterations(10000); min.setEps(1); min.setOffsetting(true); min.setMinimizerType("Minuit2"); min.migrad() m_result_migrad = min.save("migrad_result"); min.hesse(); m_result_hesse=min.save("hesse_result");
method3
m_result_hesse = m_simul->fitTo(*m_comb_data, extend, range, cpu, opt, type, offset, RooFit::Save());
where,
m_simul is RooSimultaneous object
auto extend=RooFit::Extended(true); auto range =RooFit::Range(m_xmin, m_xmax); auto cpu =RooFit::NumCPU(NCORES); auto opt = RooFit::Optimize(true); auto offset = RooFit::Offset(true); auto type = RooFit::Minimizer("Minuit2");
I am not sure what I is missing in the above calls, are there some “hidden” settings that cause the differences and I should set manual … or its normal to get that?
One last question, is there a way to use Externalconstrain with RooNLLVar?
thanks in advance,
Mazuza
mod_rf501_simultaneouspdf.C (6.3 KB)
output.txt (9.3 KB)