# Problem using RooMinimizer

Dear ROOT experts,

We are trying to understand a technical problem that we encountered in our latest analyses when the background and signal data was very low (~ 0.5). So we built this simple model for debugging.

The function is (2 bins):

L=-log(Pois(n1/b1)Pois(m1/b1+mus1)Pois(n2/b2)Pois(m2/b2+mus2))

For our purposes we specifically want to estimate MU, B1 and B2 (the MLEs). Also we don’t want to constrain MU, but we still need that Bi+MU*si >= 0 so that the Poisson functions stay defined.

So our input is n1, m1, n2, m2, s1, s2 and our desired output is MU, B1, B2.

In most cases where one of the ni’s or mi’s is zero we observe that the RooMinimizer doesn’t converge and the output we obtain is wrong. (Compared to the result from our Matlab standalone function).

An example is: n1=1, m1=0, n2=2, m2=3, s1=0.3, s2=0.4
The outcome from ROOT is MU=-1.31, B1=0.50, B2=2.84
The outcome from Matlab is MU=-2.26, B1=0.68, B2=3.11

I am unsure if this problem comes from my code, the workspace created with HistFactory or the minimizer used.

In the following link you can find my Matlab code, Root code and the terminal output: github.com/mbirman6/StatModel

We would be grateful for any advice,

Mattias

Hi,

Your ROOT macro does not compile, you are re-defining the sample sample “b” for all the channel. Is this intentional or they should be different ? This would make a different model.
Please fix the compilation error in the ROOT file,

``````root  .x main_2bin.cc

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University

In file included from input_line_9:1:
/Users/moneta/cernbox/root/tests/main_2bin.cc:74:34: error: redefinition of 'b'
RooStats::HistFactory::Sample b("b", "b", "data/2bin.root");
^
/Users/moneta/cernbox/root/tests/main_2bin.cc:57:34: note: previous definition is here
RooStats::HistFactory::Sample b("b", "b", "data/2bin.root");
^
/Users/moneta/cernbox/root/tests/main_2bin.cc:86:34: error: redefinition of 'b'
RooStats::HistFactory::Sample b("b", "b", "data/2bin.root");
^
/Users/moneta/cernbox/root/tests/main_2bin.cc:57:34: note: previous definition is here
RooStats::HistFactory::Sample b("b", "b", "data/2bin.root");
^
/Users/moneta/cernbox/root/tests/main_2bin.cc:103:34: error: redefinition of 'b'
RooStats::HistFactory::Sample b("b", "b", "data/2bin.root");
^
/Users/moneta/cernbox/root/tests/main_2bin.cc:57:34: note: previous definition is here
RooStats::HistFactory::Sample b("b", "b", "data/2bin.root");
^``````

and I guess also one needs the file data/2bin.root to run it. Is it in your Github ? I did not find it

Cheers

Lorenzo

Hi Lorenzo,

I posted an update of the macro in the github: github.com/mbirman6/StatModel

But it was running for me before (and still is). I’m using root version 5.34/34.

The “b” sample was simply defined as unity so that its shapefactors would give me the ML estimators B1 and B2. But I guess re-defining it for every channel was a mistake.

The data/2bin.root file is created in the main function (line 136) but probably you need to create the directories /data and /results .

Best,

Mattias

Small update: I checked the macro and it runs in ROOT 6 but still gives the same error.
I attached it here for simplicity. I’d be grateful for any advice.
Cheers,
Mattias
main_2bin.cc (4.88 KB)

HI,

Thank you for the update. I can reproduce now your problem. It is true, by setting the likelihood parameters to the Matlab minimum value, I get a lower likelihood value, 10.05 instead of 10.16. So that minimum is better.
There are several error produced during the minimisation, this could be one of the causes.
I will investigate it, but I might take some time.
Which algorithm did you use in Matlab to find the minimum ?

Best Regards

Lorenzo

In matlab I am using the built-in function fmincon (with constraints).

Also interesting note: I was able to reproduce the results a lot faster and with better sensitivity if I replace in the likelihood function the expressions of bi_hat_hat (function of mu_hat and independent one from another) and use fminunc (unconstrained). This turns my model into a one parameter problem. But I don’t know if it would work with more complex models.

Thanks again,

Mattias