# Why profile likelihood returns profile likelihood ratio?

Dear experts,

why when computing the profile likelihood I get a value == 0 at the minimum (as if it is a profile likelihood ratio)?

Just try this simple program:

``````mean = ROOT.RooRealVar("mean", "mean", 10, 9.5, 10.5)
sigma = ROOT.RooRealVar("sigma", "sigma", 10, 0, 10)
x = ROOT.RooRealVar("x", "x", -20, 30)

model = ROOT.RooGaussian("gaus", "gaus", x, mean, sigma)
obs_set = ROOT.RooArgSet(x)
data = model.generate(obs_set, 10000)

nll = model.createNLL(data)
profile_set = ROOT.RooArgSet(mean)
nllp = nll.createProfile(profile_set)

frame = mean.frame()
nllp.plotOn(frame)
frame.Draw()

model.fitTo(data)

nll.getVal() # 36262.210623989995

nllp.getVal() # 0.0``````

The last two numbers should be equal, since they are computed at the minimum.

Hi,

The class RooProfileLL, see implements the log of the profile likelihood ratio

root.cern.ch/root/html/RooProfileLL.html

Best Regards

Lorenzo

[quote=“moneta”]Hi,

The class RooProfileLL, see implements the log of the profile likelihood ratio

root.cern.ch/root/html/RooProfileLL.html

Best Regards

Lorenzo[/quote]

Thank you. From the documentation I read “RooProfileLL is the input likelihood nll minimized w.r.t all nuisance parameters (which are all parameters except for those listed in the constructor) minus the -log(L) of the best fit”.

I guess that ProfileLL means “profiled log likelihood”, so I don’t understand why it returns something different from its name. By the way it seems that it could be solved using the function

``void	setAlwaysStartFromMin(Bool_t flag)``

I tried to call it just after the creation of the profiled likelihood ratio as:

``````nllp = nll.createProfile(profile_set)
nllp.setAlwaysStartFromMin(False)``````

I tried also True as argument, but it doesn’t work, at least in 5.34/24.

Hi,
The flag refers to the starting point of the likelihood minimisation to compute the profile likelihood value.
I do not understand your problem. If you don’t want to have the PLR to be zero at the minimum, just add the minimum likelihood value. Do something like ( I assume you did not minimise the likelihood before):

``````auto nllp = nll.createProfile(profile_set);
double profileLogLikelihoodRatio_value = nllp.getVal();
auto vars = nll.getVariables();
*vars = nllp.bestFitObs();
*vars = nllp.bestFitParams;
double minNLL = nll.getVal();
double profileLogLikelihood_value =  profileLogLikelihoodRatio_value + minNLL; ``````

Lorenzo