Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Rolke.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Example of the usage of the TRolke class The TRolke class computes the profile likelihood confidence limits for 7 different model assumptions on systematic/statistical uncertainties

Please read TRolke.cxx and TRolke.h for more docs.

========================================================
For model 1: Poisson / Binomial
the Profile Likelihood interval is :
[0,11.5943]
========================================================
For model 2 : Poisson / Gaussian
the Profile Likelihood interval is :
[3.88417,18.4584]
========================================================
For model 3 : Gaussian / Gaussian
the Profile Likelihood interval is :
[0,17.5005]
***************************************
* some more example's for gauss/gauss *
* *
sensitivity:
[0.00213408,9.0817]
median limit:
[0,9.21861] @ x =5
ML limit:
[0,9.21861] @ x =5
sensitivity:
[0.00213408,18.3004]
the Profile Likelihood interval is :
[0,17.5005]
critical number: 13
critical number for 5 sigma: 21
***************************************
========================================================
For model 4 : Poissonian / Known
the Profile Likelihood interval is :
[0,4.08807]
========================================================
For model 5 : Gaussian / Known
the Profile Likelihood interval is :
[0,4.91504]
========================================================
For model 6 : Known / Binomial
the Profile Likelihood interval is :
[11.4655,36.3035]
========================================================
For model 7 : Known / Gaussian
the Profile Likelihood interval is :
[0,20.1747]
Example of the effect of bounded vs unbounded, For model 1
the BOUNDED Profile Likelihood interval is :
[0,1.1729]
the UNBOUNDED Profile Likelihood interval is :
[0,0.936334]
#include "TROOT.h"
#include "TSystem.h"
#include "TRolke.h"
#include "Riostream.h"
void Rolke()
{
// variables used throughout the example
Double_t tau;
Int_t mid;
Int_t z;
Double_t sde;
Double_t sdb;
Double_t alpha; //Confidence Level
// make TRolke objects
TRolke tr; //
Double_t ul ; // upper limit
Double_t ll ; // lower limit
//-----------------------------------------------
// Model 1 assumes:
//
// Poisson uncertainty in the background estimate
// Binomial uncertainty in the efficiency estimate
//
cout << endl<<" ======================================================== " <<endl;
mid =1;
x = 5; // events in the signal region
y = 10; // events observed in the background region
tau = 2.5; // ratio between size of signal/background region
m = 100; // MC events have been produced (signal)
z = 50; // MC events have been observed (signal)
alpha=0.9; //Confidence Level
tr.SetCL(alpha);
tr.GetLimits(ll,ul);
cout << "For model 1: Poisson / Binomial" << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
//-----------------------------------------------
// Model 2 assumes:
//
// Poisson uncertainty in the background estimate
// Gaussian uncertainty in the efficiency estimate
//
cout << endl<<" ======================================================== " <<endl;
mid =2;
y = 3 ; // events observed in the background region
x = 10 ; // events in the signal region
tau = 2.5; // ratio between size of signal/background region
em = 0.9; // measured efficiency
sde = 0.05; // standard deviation of efficiency
alpha =0.95; // Confidence L evel
tr.SetCL(alpha);
tr.SetPoissonBkgGaussEff(x,y,em,tau,sde);
tr.GetLimits(ll,ul);
cout << "For model 2 : Poisson / Gaussian" << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
//-----------------------------------------------
// Model 3 assumes:
//
// Gaussian uncertainty in the background estimate
// Gaussian uncertainty in the efficiency estimate
//
cout << endl<<" ======================================================== " <<endl;
mid =3;
bm = 5; // expected background
x = 10; // events in the signal region
sdb = 0.5; // standard deviation in background estimate
em = 0.9; // measured efficiency
sde = 0.05; // standard deviation of efficiency
alpha =0.99; // Confidence Level
tr.SetCL(alpha);
tr.SetGaussBkgGaussEff(x,bm,em,sde,sdb);
tr.GetLimits(ll,ul);
cout << "For model 3 : Gaussian / Gaussian" << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
cout << "***************************************" << endl;
cout << "* some more example's for gauss/gauss *" << endl;
cout << "* *" << endl;
Double_t slow,shigh;
tr.GetSensitivity(slow,shigh);
cout << "sensitivity:" << endl;
cout << "[" << slow << "," << shigh << "]" << endl;
int outx;
tr.GetLimitsQuantile(slow,shigh,outx,0.5);
cout << "median limit:" << endl;
cout << "[" << slow << "," << shigh << "] @ x =" << outx <<endl;
tr.GetLimitsML(slow,shigh,outx);
cout << "ML limit:" << endl;
cout << "[" << slow << "," << shigh << "] @ x =" << outx <<endl;
tr.GetSensitivity(slow,shigh);
cout << "sensitivity:" << endl;
cout << "[" << slow << "," << shigh << "]" << endl;
tr.GetLimits(ll,ul);
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
Int_t ncrt;
cout << "critical number: " << ncrt << endl;
tr.SetCLSigmas(5);
cout << "critical number for 5 sigma: " << ncrt << endl;
cout << "***************************************" << endl;
//-----------------------------------------------
// Model 4 assumes:
//
// Poisson uncertainty in the background estimate
// known efficiency
//
cout << endl<<" ======================================================== " <<endl;
mid =4;
y = 7; // events observed in the background region
x = 1; // events in the signal region
tau = 5; // ratio between size of signal/background region
e = 0.25; // efficiency
alpha =0.68; // Confidence L evel
tr.SetCL(alpha);
tr.GetLimits(ll,ul);
cout << "For model 4 : Poissonian / Known" << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
//-----------------------------------------------
// Model 5 assumes:
//
// Gaussian uncertainty in the background estimate
// Known efficiency
//
cout << endl<<" ======================================================== " <<endl;
mid =5;
bm = 0; // measured background expectation
x = 1 ; // events in the signal region
e = 0.65; // known eff
sdb = 1.0; // standard deviation of background estimate
alpha =0.799999; // Confidence Level
tr.SetCL(alpha);
tr.SetGaussBkgKnownEff(x,bm,sdb,e);
tr.GetLimits(ll,ul);
cout << "For model 5 : Gaussian / Known" << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
//-----------------------------------------------
// Model 6 assumes:
//
// Known background
// Binomial uncertainty in the efficiency estimate
//
cout << endl<<" ======================================================== " <<endl;
mid =6;
b = 10; // known background
x = 25; // events in the signal region
z = 500; // Number of observed signal MC events
m = 750; // Number of produced MC signal events
alpha =0.9; // Confidence L evel
tr.SetCL(alpha);
tr.GetLimits(ll,ul);
cout << "For model 6 : Known / Binomial" << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
//-----------------------------------------------
// Model 7 assumes:
//
// Known Background
// Gaussian uncertainty in the efficiency estimate
//
cout << endl<<" ======================================================== " <<endl;
mid =7;
x = 15; // events in the signal region
em = 0.77; // measured efficiency
sde = 0.15; // standard deviation of efficiency estimate
b = 10; // known background
alpha =0.95; // Confidence L evel
y = 1;
tr.SetCL(alpha);
tr.SetKnownBkgGaussEff(x,em,sde,b);
tr.GetLimits(ll,ul);
cout << "For model 7 : Known / Gaussian " << endl;
cout << "the Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
//-----------------------------------------------
// Example of bounded and unbounded likelihood
// Example for Model 1
bm = 0.0;
tau = 5;
mid = 1;
m = 100;
z = 90;
y = 15;
x = 0;
alpha = 0.90;
tr.SetCL(alpha);
tr.SetBounding(true); //bounded
tr.GetLimits(ll,ul);
cout << "Example of the effect of bounded vs unbounded, For model 1" << endl;
cout << "the BOUNDED Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
tr.SetBounding(false); //unbounded
tr.GetLimits(ll,ul);
cout << "the UNBOUNDED Profile Likelihood interval is :" << endl;
cout << "[" << ll << "," << ul << "]" << endl;
}
#define b(i)
Definition RSha256.hxx:100
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
This class computes confidence intervals for the rate of a Poisson process in the presence of uncerta...
Definition TRolke.h:34
void SetGaussBkgKnownEff(Int_t x, Double_t bm, Double_t sdb, Double_t e)
Model 5: Background - Gaussian, Efficiency - known (x,bm,sdb,e.
Definition TRolke.cxx:302
bool GetLimitsML(Double_t &low, Double_t &high, Int_t &out_x)
get the upper and lower limits for the most likely outcome.
Definition TRolke.cxx:511
bool GetCriticalNumber(Int_t &ncrit, Int_t maxtry=-1)
get the value of x corresponding to rejection of the null hypothesis.
Definition TRolke.cxx:546
void SetKnownBkgBinomEff(Int_t x, Int_t z, Int_t m, Double_t b)
Model 6: Background - known, Efficiency - Binomial (x,z,m,b)
Definition TRolke.cxx:327
void SetPoissonBkgKnownEff(Int_t x, Int_t y, Double_t tau, Double_t e)
Model 4: Background - Poisson, Efficiency - known (x,y,tau,e)
Definition TRolke.cxx:277
void SetBounding(const bool bnd)
Definition TRolke.h:184
void SetKnownBkgGaussEff(Int_t x, Double_t em, Double_t sde, Double_t b)
Model 7: Background - known, Efficiency - Gaussian (x,em,sde,b)
Definition TRolke.cxx:352
void SetGaussBkgGaussEff(Int_t x, Double_t bm, Double_t em, Double_t sde, Double_t sdb)
Model 3: Background - Gaussian, Efficiency - Gaussian (x,bm,em,sde,sdb)
Definition TRolke.cxx:252
void SetPoissonBkgGaussEff(Int_t x, Int_t y, Double_t em, Double_t tau, Double_t sde)
Model 2: Background - Poisson, Efficiency - Gaussian.
Definition TRolke.cxx:226
bool GetSensitivity(Double_t &low, Double_t &high, Double_t pPrecision=0.00001)
get the upper and lower average limits based on the specified model.
Definition TRolke.cxx:446
bool GetLimitsQuantile(Double_t &low, Double_t &high, Int_t &out_x, Double_t integral=0.5)
get the upper and lower limits for the outcome corresponding to a given quantile.
Definition TRolke.cxx:481
bool GetLimits(Double_t &low, Double_t &high)
Calculate and get the upper and lower limits for the pre-specified model.
Definition TRolke.cxx:373
void SetPoissonBkgBinomEff(Int_t x, Int_t y, Int_t z, Double_t tau, Int_t m)
Model 1: Background - Poisson, Efficiency - Binomial.
Definition TRolke.cxx:201
void SetCL(Double_t CL)
Definition TRolke.h:124
void SetCLSigmas(Double_t CLsigmas)
Definition TRolke.h:129
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TMarker m
Definition textangle.C:8
Authors
Jan Conrad, Johan Lundberg

Definition in file Rolke.C.