Log-Likelihood curve after using fitTo

Hi,

My goal is to extract the log-likelihood curve for a parameter of interest after calling fitTo. I have seen some examples like this one: ROOT: tutorials/roofit/rf605_profilell.C File Reference but the catch is that I am fitting five different observables simultaneously. This was discussed and solved in this post: Simultaneous 1D likelihood fits in different observables, with multiple PDFs. Now I want to get the log-likelihood curve with respect to a single parameter of interest (call this ‘signal’) which I think would make it a profile log-likelihood of ‘signal’. What I have tried so far is something like this (based on the example link rf605 above):

RooAbsReal *nll_full = simpdf.createNLL(combData);
RooAbsReal *pll_nsig = nll_full->createProfile(nsig);
RooPlot *nllframe = nsig.frame();
pll_nsig->plotOn(nllframe);

That was placed after fitTo has been called. However, this didn’t work and I kinda expected it not to due to the complicated nature of setting up my data and PDFs, or maybe I am calling createNLL and createProfile incorrectly for my particular case.

Otherwise, I was considering a ‘brute force’ method, where I manually scan through a range of ‘signal’ values, fitting each time and recording the minNLL and plot the profile likelihood from there. This should do the trick but I was wondering if there is a way to extract it directly from fitTo.

Thanks for any help/comments!

Hi @ilam,

how did the profileLL not work? Since the profile is made in a parameter, it doesn’t matter how many observables you have. If you are only interested in one parameter, it should just run.

Hi @StephanH ,

The canvas that I draw the profileLL to is blank and my terminal is filled with the kind of errors shown below. There were no errors when doing fitTo, only when calling doing createNLL and createProfile. That’s why I am guessing I am not doing something correctly.

[#0] ERROR:Eval – RooAbsReal::logEvalError(modelE) evaluation error,
origin : RooAddPdf::modelE[ nBi * pdf_Bi_int_calenergy + nTl * pdf_Tl_int_calenergy + nsol * pdf_sol_calenergy + next * pdf_ext_calenergy + nreac * pdf_reac_calenergy + natm * pdf_atm_calenergy + nsig * pdf_sig_calenergy + ncont * pdf_cont_calenergy ]
message : p.d.f value is less than zero (-0.000026), forcing value to zero
server values: !refCoefNorm=(), !pdfs=(pdf_Bi_int_calenergy = 0/2060,pdf_Tl_int_calenergy = 0/11667,pdf_sol_calenergy = 10639.7/97479.5,pdf_ext_calenergy = 0/534.86,pdf_reac_calenergy = 460/32232,pdf_atm_calenergy = 28430/1.92665e+06,pdf_sig_calenergy = 28430/1.92665e+06,pdf_cont_calenergy = 28430/1.92665e+06), !coefficients=(nBi = 4205.17 +/- 3970.42,nTl = 49.4956 +/- 0,nsol = 5.79037 +/- 0,next = 18.4261 +/- 0,nreac = 0.0175866 +/- 0,natm = 0.206616 +/- 0,nsig = -50.5 +/- 0,ncont = 0.00953674 +/- 0)
[#0] ERROR:Eval – RooAbsReal::logEvalError(modelE) evaluation error,
origin : RooAddPdf::modelE[ nBi * pdf_Bi_int_calenergy + nTl * pdf_Tl_int_calenergy + nsol * pdf_sol_calenergy + next * pdf_ext_calenergy + nreac * pdf_reac_calenergy + natm * pdf_atm_calenergy + nsig * pdf_sig_calenergy + ncont * pdf_cont_calenergy ]
message : getLogVal() top-level p.d.f evaluates to zero
server values: !refCoefNorm=(), !pdfs=(pdf_Bi_int_calenergy = 0/2060,pdf_Tl_int_calenergy = 0/11667,pdf_sol_calenergy = 10639.7/97479.5,pdf_ext_calenergy = 0/534.86,pdf_reac_calenergy = 460/32232,pdf_atm_calenergy = 28430/1.92665e+06,pdf_sig_calenergy = 28430/1.92665e+06,pdf_cont_calenergy = 28430/1.92665e+06), !coefficients=(nBi = 4205.17 +/- 3970.42,nTl = 49.4956 +/- 0,nsol = 5.79037 +/- 0,next = 18.4261 +/- 0,nreac = 0.0175866 +/- 0,natm = 0.206616 +/- 0,nsig = -50.5 +/- 0,ncont = 0.00953674 +/- 0)
[#0] ERROR:Eval – RooAbsReal::logEvalError(E) evaluation error,
origin : RooNLLVar::E[ paramSet=(nBi,nTl,natm,ncont,next,nreac,nsig,nsol) ]
message : function value is NAN
server values: paramSet=(nBi = 4205.17 +/- 3970.42,nTl = 49.4956 +/- 0,natm = 0.206616 +/- 0,ncont = 0.00953674 +/- 0,next = 18.4261 +/- 0,nreac = 0.0175866 +/- 0,nsig = -50.5 +/- 0,nsol = 5.79037 +/- 0)
[#0] ERROR:Eval – RooAbsReal::logEvalError(nll_simpdf_combData) evaluation error,
origin : RooNLLVar::nll_simpdf_combData[ paramSet=(nBi,nTl,natm,ncont,next,nreac,nsig,nsol) ]
message : function value is NAN
server values: paramSet=(nBi = 4205.17 +/- 3970.42,nTl = 49.4956 +/- 0,natm = 0.206616 +/- 0,ncont = 0.00953674 +/- 0,next = 18.4261 +/- 0,nreac = 0.0175866 +/- 0,nsig = -50.5 +/- 0,nsol = 5.79037 +/- 0)
[#0] ERROR:Eval – RooAbsReal::logEvalError(nll_simpdf_combData_Profile[nsig]) evaluation error,
origin : RooProfileLL::nll_simpdf_combData_Profile[nsig][ nll=nll_simpdf_combData obs=(nsig) par=(nBi,nTl,natm,ncont,next,nreac,nsol) ]
message : function value is NAN

Hi @ilam,

that could be a sign of disallowed parameter values. If you create the profileLL manually, and try to evaluate it for signal values that are very close to the best-fit point, does it work?
I could imagine that the fit model is a bit unstable, so if you dislocate the signal too far from the best-fit point, nuisance parameters might start to jump around wildly, leading to a negative PDF, as seen in the log you posted. This can only be avoided by disallowing certain values. In your particular case, this caught my attention:

Look at the coefficients of the AddPdf. The signal is -50.5 * signalPdf, and you are adding that to backgrounds, which are often 0. This won’t work. As you are profiling in nsig, you can probably just exclude the very negative values of nsig, and get a stable model. Try to limit the range of nsig, so the profile doesn’t go into disallowed regions.

Hi @StephanH

I tried limiting the parameter fit range in the negative range as you suggested but it still did not work. But if I evaluate the signal around the best-fit point, the fit does converge and I am able to abstract the minimum value.

This means that you limited the range of the profile for nsig to exclude very negative POIs? That’s what I meant when I said “limit the range”.

What I did was change the allowed range in the RooRealVar of nsig. Is this what you were referring to? I couldn’t find any other way to limit the range of nsig.

That’s what I meant. I am surprised, though, that is doesn’t work. If you never test the very negative values of nsig, the fitter shouldn’t to into a disallowed region, unless there’s another parameter that can also create problems.

Ok, I was restricting the range correctly then. Yea, my fit has quite a few variable floating and I am fitting several data sets simultaneously, so that could be contributing to the issue. I’ll try digging a bit more.

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