# Feldman-Cousins of 2 POI Method

**URL:** <https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002>\
**Category:** Roofit and RooStats\
**Created:** [March 2, 2022, 3:19pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002 "2022-03-02T15:19:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 2, 2022, 3:19pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/1 "2022-03-02T15:19:09Z")

</div>

Dear Experts,  
I am working in the B Physics group.  
In our analysis, we want to perform a study on “Feldman- Cousins of two POI methods”, for which I am not sure about the technical procedure.  
Could you please point me to some reference or provide some skeleton code for the above method, so that I could start working on it?

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [March 4, 2022, 10:07am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/2 "2022-03-04T10:07:36Z")

</div>

@moneta or @jonas might have an answer?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 4, 2022, 3:06pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/3 "2022-03-04T15:06:19Z")

</div>

Hi,

For doing a Feldman-Cousins in 2D you need to use the FeldmanCousins class. We have a tutorial example using it in 2D,  
[https://root.cern.ch/doc/master/rs401d\_\_FeldmanCousins\_8C.html](https://root.cern.ch/doc/master/rs401d__FeldmanCousins_8C.html)

The problem is to find the right points to scan. Note that the FeldmanCousins has an interface to provide these points ([FeldmanCousins::SetPoiPointsToTest](https://root.cern.ch/doc/master/classRooStats_1_1FeldmanCousins.html#a344c712f5bf521fce8a359b36d76e425), the difficult is to find these points close to the contour line.

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 5, 2022, 5:14am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/4 "2022-03-05T05:14:13Z")

</div>

Thanks, @moneta, and @etejedor, for sharing the reference code. I will try this and let you know if face any difficulties.

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 9, 2022, 2:35pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/5 "2022-03-09T14:35:36Z")

</div>

Dear @moneta,  
I followed the tutorial code on the F-C 2D method (shared by you) and prepared a similar code relevant to my analysis.  
Currently, I am using a model where Bs mass is my variable and I have considered the mean and sigma1 to be my POI for demonstration.  
When I draw the contours using the F-C test statistics, I am getting some weird tiny contour-like structure, but not really contours.  
I have attached the plot and the script here.  
(size of test = 0.05, number of points to test per parameter = 20, CL = 0.683)  
Could you please have a look and let me know if I am doing anything wrong?

 ![FC_2D_TEST](https://root-forum.cern.ch/uploads/default/original/3X/e/8/e895f9071bb21322b31dab386142847d865bc253.png)

Regards,  
Samar

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 9, 2022, 3:31pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/6 "2022-03-09T15:31:26Z")

</div>

Hi,  
Can you please share the code you are using so I can have a look, probably not before tomorrow.  
Thanks

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 9, 2022, 4:09pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/7 "2022-03-09T16:09:43Z")

</div>

Hi,  
Sure!  
Please find the code.  
[FC\_2D\_test\_2.C](https://root-forum.cern.ch/uploads/short-url/1aLrgihKiXGtOaWyPgPpUzTheUb.C) (10.0 KB)

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 10, 2022, 6:19am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/8 "2022-03-10T06:19:40Z")

</div>

Please have a look. I have already shared with you the code.

Regards,  
Samar

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 11, 2022, 11:21am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/9 "2022-03-11T11:21:28Z")

</div>

Hi,

Thank you for sharing the code, it is very useful When trying with the new release it seems the model prints me a large number of error message for the undefined normalisation of the RooAddPdf.  
I will investigate this further and let you know

Cheers  
Lorenzo

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 11, 2022, 3:06pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/10 "2022-03-11T15:06:24Z")

</div>

Hi,

I think the problem is that you are performing the FC scan in a 20x20 region which is too large. Try to set the [min,max] values of the POI in a region around few sigma to the fitted value. For example reducing the POI interval, I am getting this plot (the FC contour is the red one and it is a 90% contour ) and should be the same (if asymptotic works) as the orange one from the profile likelihood.  
[plot.pdf](https://root-forum.cern.ch/uploads/short-url/15w7d41upYCVR7AiXvZrWXnkpPB.pdf) (38.6 KB)

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 11, 2022, 6:12pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/11 "2022-03-11T18:12:01Z")

</div>

Dear Moneta,  
Thanks a lot for looking into the issue. The F-C contour indeed looks better now.  
Could you please share the script that you have used to get the plot so that I could able to reproduce the same?

Best regards,  
Samar

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 11, 2022, 9:59pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/12 "2022-03-11T21:59:51Z")

</div>

Here it is (the CL of the Feldman cousins is 95% in this version).  
I send you a link since I have some problems uploading the file  
[https://cernbox.cern.ch/index.php/s/H5c54MhmJu0tNaN](https://cernbox.cern.ch/index.php/s/H5c54MhmJu0tNaN)

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 12, 2022, 7:00am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/13 "2022-03-12T07:00:29Z")

</div>

Dear Moneta,  
Thanks for sharing the modified code. I reproduced the contours and the plots are coming fine.  
Thank you.

Regards,  
Samar

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 16, 2022, 1:55pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/14 "2022-03-16T13:55:27Z")

</div>

Dear Moneta,  
I have now modified the previous code accordingly to my Analysis, where I have used a 3D (Bs mass, CosThetak, CosThetaL) fitting model.  
Now my POIs are two angular observables known as afb [-1.0 -1.0] and fl [0.0-1.0], having a physical boundary region.  
When I try to plot the likelihood of the above two variables, it throws me the following error,  
error: no matching function for call to ‘YVar’  
TH1 \*hhh = pll.createHistogram(“hhh”, \*afb, Binning(20), YVar(\*fl, Binning(20)), Scaling(kFALSE));  
^~~~  
/home/samar/Downloads/root/include/RooGlobalFunc.h:265:11: note: candidate function not viable: no known conversion from ‘RooAbsReal’ to ‘const RooAbsRealLValue’ for 1st argument  
RooCmdArg YVar(const RooAbsRealLValue& var, const RooCmdArg& arg=RooCmdArg::none()) ;

I couldn’t fix it. Could you please have a look?  
I have attached the code and the workspace file here.

Best Regards,  
Samar

[FC\_2D\_test\_8\_ws.C](https://root-forum.cern.ch/uploads/short-url/xhiz6mRrz4q6dwdGXgf96nlFDEc.C) (12.9 KB)

[wspace\_summaryLowQ2.root](https://root-forum.cern.ch/uploads/short-url/rXulRg6Ghnd3vsRJ2owm2ZkwwOw.root) (69.5 KB)

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 16, 2022, 3:25pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/15 "2022-03-16T15:25:51Z")

</div>

Hi,  
The problem is that you should pass a variable (i.e. a RooRealVar) in `RooFit::YVar`, instead you are passing fl which seems to be a function (a RooAbsReal object).

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 20, 2022, 11:54pm UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/16 "2022-03-20T23:54:59Z")

</div>

Dear Moneta,  
Sorry for the late reply. Yes, that’s correct, currently the variables (fl, afb) saved, are functions, not RooRealVar. But I want to plot the profiled likelihood of these two variables for my analysis.  
Could you please suggest how can I do that?

Regards,  
Samar

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 21, 2022, 9:40am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/17 "2022-03-21T09:40:34Z")

</div>

Hi,  
I am confused, the likelihood must be a function of some parameters (variables) not function. If fl and afb are functions of something you should use their variables are the parameters of your problem.

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 22, 2022, 6:45am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/18 "2022-03-22T06:45:36Z")

</div>

Dear Lorenzo,  
This is understood.  
But is there any way to get the likelihood of a function instead of parameters?

Regards,  
Samar

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 22, 2022, 8:18am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/19 "2022-03-22T08:18:57Z")

</div>

Hi,  
Can you provide a concrete example ? You can always interpret a function as a parameter, and re-parametrize your problem. For example you can have a Likelihood L(p1,p2) and you can also parametrize as q1,q2 where q1(p1,p2) and q2(p1,p2) where q1 and q2 are functions of the parameters p1,p2. But when you describe the problem in RooFit you need to define them as variables and not as functions.

Cheers

Lorenzo

---

<div class="post-metadata">

**Author:** ![Samarendra\_Nayak](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/samarendra_nayak/32/28946_2.png) [@Samarendra\_Nayak](https://root-forum.cern.ch/u/Samarendra_Nayak)\
**Post date:** [March 22, 2022, 9:11am UTC](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002/20 "2022-03-22T09:11:30Z")

</div>

Dear Lorenzo,  
I completely agree with you.  
But I wanted to know if I have a Likelihood L(p1,p2), then how I can parametrize it in terms of q1, q2 where q1(p1, p2) and q2(p1, p2) (q1 and q2 are functions of the parameters p1,p2).  
In my case, the parameters are unboundFl and unboundAfb, and the functions are fl and afb respectively, where  
RooFormulaVar fl(“fl”, “0.5+TMath::ATan(\*unboundFl)/TMath::Pi()”, RooArgList(\*unboundFl))

RooFormulaVar afb(“afb”, “2.0\*(1.-fl)\*TMath::ATan(\*unboundAfb)/TMath::Pi()”, RooArgList(\*unboundAfb,fl)) .  
Now I want to plot the likelihood between fl and afb, that’s my concern.  
I have attached the likelihood plot between unboundFl and unboundAfb.

Regards,  
Samar

[3D\_Model\_test.pdf](https://root-forum.cern.ch/uploads/short-url/A7QkIqbZ6tQD3RFoDya9OzmUnYi.pdf) (35.9 KB)

[Next page](https://root-forum.cern.ch/t/feldman-cousins-of-2-poi-method/49002.md?page=2)
