Home | News | Documentation | Download

Problem implementing Student-t function in roofit using RooGeneric Pdf


#1

Hello everyone,

I am trying to implement the student-t function with the following functional form in Roofit:
$\frac{\Gamma \left( \frac{r+1}{2} \right)}{\Gamma \left( \frac{r}{2} \right)}\frac{1}{\sigma\sqrt[2]{\pi r}} \big{ 1 + \frac{(\Delta M -\overline{x}_{t})^{2}}{r\sigma^{2}} \big}^{-(\frac{r+1}{2})}$

where deltam is fit variable and sigma, xbar and r are shape parameters.

I am using RooGenericPdf for implementing this pdf. My fit pdf is a combination of (gauss+gauss+student-t) and I am performing unbinned extended maximum likelihood fit. I get a lot of errors which can be summarized into the following:

1> [#0] WARNING:Eval – RooAddPdf::updateCoefCache(dg_mdz1 WARNING: sum of PDF coefficients not in range [0-1], value=1.44797[#0] WARNING:Eva\

2>p.d.f normalization integral is zero or negative @ actualVars=(deltam = 0.145328,r = -2.67885,meant = 0.144452,sigmat = 0.00179944)

3> p.d.f value is Not-a-Number (nan), forcing value to zero @ actualVars=(deltam = 0.145898,r = -0.311657,meant = 0.147132,sigmat = 0.00115821)

4> getLogVal() top-level p.d.f evaluates to zero @ !refCoefNorm=(), !pdfs=(dg_mdz1 = -0.393874/1), !coefficients=(nsig = 9.15084e+06)

But after all these errors repeated multiple times MIGRAD converged and MINOS get STATUS = successful and error matrix accurate. Should I be worried about all those errors or just ignore them and use the final result ??

I am attaching the fit logsignal1d_yieldc.txt (174.4 KB)
final fit plot deltam_signal_1d_yieldchange.pdf (38.5 KB)
fitting code deltam_signal.C (10.1 KB)

dataset used: signal_new.txt (2.1 MB)

Please let me know if the query is not clear or any further information is required.
Aman


#2

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


#3

Our RooFit expert, @Hageboeck , is traveling, back next week. I hope he can have a look once back? Or someone else (e.g. @vcroft) can help?


#4

#5

Hello @amroo,

Coefficients in RooAddPdf

[#0] WARNING:Eval – RooAddPdf::updateCoefCache(dg_mdz1 WARNING: sum of PDF coefficients not in range [0-1], value=1.44797

this will create problems. When computing a RooAddPdf, the coefficients should be summing to 1. Apparently, the fitter seems to favour a region where c_1 + c_2 > 1, and c_3 cannot be less than 0. There is a way to parametrise the coefficients recursively, ensuring that the sum of all coefficients is always < 1. See
https://root.cern.ch/doc/master/classRooAddPdf.html

Negative PDF
Further, when I run your example without data, I get
[#0] ERROR:InputArguments -- dg_mdz: calculated negative expected events: -100

So I asked myself: Could it be that your PDF evaluates to negative values? In that case, normalisations and computing the logarithm will not work. When plotting it before fitting, it looks ok:

However, you can easily make it negative:
Both nsig and r can turn negative, yielding a negative function value. The degrees of freedom for the Student-t should even be strictly positive …
I suggest to limit their ranges to e.g. [1.E-5, xxx] or so to keep the function positive. You might have to adjust that range a bit to ensure that the PDF is >=0 everywhere.

PS:
You can also extend a PDF like this:

RooRealVar nsig("nsig","nsig",4,1,10000000);
RooExtendPdf dg_mdz("dg_mdz","dg_mdz",dg_mdz1,nsig);

#6

@Hageboeck Thanks for replying.

I made following changes to my fitting code:
1> Limit the ranges of r and nsig to positive values only.
2> Declared the coefficients recursively as follows:
RooFormulaVar fr2(“fr2”,"(1-frac_gauss1)xfrac_gauss2",RooArgSet(frac_gauss1,frac_gauss2));
RooFormulaVar fr3(“fr3”,"(1-frac_gauss1)x(1-frac_gauss2)xfrac_gauss3",RooArgSet(frac_gauss1,frac_gauss2,frac_gauss3));
dg_mdz1(“dg_mdz1”,“dg_mdz1”,RooArgList(gauss1,gauss2,student_t),RooArgList(frac_gauss1,fr2,fr3));

where the parameters frac_gauss1,frac_gauss2 and frac_gauss3 are declared as follows:
RooRealVar frac_gauss3(“frac_gauss3”,“frac_gauss3”,0.53,0,1.0);
RooRealVar frac_gauss1(“frac_gauss1”,“frac_core”,0.60,0,1);
RooRealVar frac_gauss2(“frac_gauss2”,“frac_gauss2”,0.10,0,1);

Now all the previous error messages are gone. I just have to adjust the parameters to make the fit converge.

Thanks


#7

Hi @Hageboeck just one clarification.
According to my understanding the sum of all coefficients should be “equal” to 1, as all the individual pdf are normalized and the final pdf(sum) also should be normalized. So, the sum of coefficients should be =1 and not <1 ??
Thanks for you time.
Aman


#8

That’s correct! Good to know that it’s working now.