Get likelihood values from a plot drawn by a class "LikelihoodIntervalPlot"

Dear experts,

Hello, I have a question in profile likelihood analysis by roostats.
As a practice, I used “StandardProfileLikelihoodDemo.C” in $ROOTSYS/tutorial/roostats/.

I can show the log-likelihood parabola using above macro, so now I’d like to extract this curve as a function.
I just would like to know the parameter of this calculated parabolic function.
Or I’d like to extract each likelihood value and x-axis value as a ASCII style.
Is it possible?

This is because I’m planing to combine some log-likelihood curves after I get curves.
So I need to reconstruct the shape of calculated parabola.

Thank you so much for your support in advance.

best regards,
Tomo

Hi,

If you use the option “tf1” for drawing the likelihood, LikelihoodIntervalPlot::Draw("tf1") ,
the plotted object is actually an histogram, a TH1 and you can retrieve it using
LikelihoodIntervalPlot::GetPlottedObject(), then you can retrieve the corresponding likelihood values as bin content of the histogram. Example:

LikelihoodIntervalPlot plot(interval);
plot.SetNPoints(nScanPoints);   // nScanPoints will be the number of histogram bins
plot.SetRange(xmin, xmax);
plot.Draw("tf1");
auto h = (TH1*) plot.GetPlottedObjet(); 
for (int i = 1; i <= h->GetNbinsX(); ++i) 
   std::cout << " x = " << h->GetBinCenter(i) << " Liikelihood(x) = " << h->GetBinContent(i) << std::endl;

Lorenzo

Thank you so much for your quick reply!!
And I succeeded to do it following your suggestion.

Thank you so much again.

best regards,
Tomo

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