Logo ROOT  
Reference Guide
NumberCountingUtils.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer 28/07/2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
14
16
17// // Without this macro the THtml doc can not be generated
18// #if !defined(R__ALPHA) && !defined(R__SOLARIS) && !defined(R__ACC) && !defined(R__FBSD)
19// NamespaceImp(RooStats)
20// //NamespaceImp(NumberCountingUtils)
21// #endif
22
23//using namespace RooStats;
24
26 // Expected P-value for s=0 in a ratio of Poisson means.
27 // Here the background and its uncertainty are provided directly and
28 // assumed to be from the double Poisson counting setup described in the
29 // BinomialWithTau functions.
30 // Normally one would know tau directly, but here it is determiend from
31 // the background uncertainty. This is not strictly correct, but a useful
32 // approximation.
33
34
35 //SIDE BAND EXAMPLE
36 //See Eqn. (19) of Cranmer and pp. 36-37 of Linnemann.
37 //150 total events in signalExp region, 100 in sideband of equal size
38 Double_t mainInf = signalExp+backgroundExp; //Given
39 Double_t tau = 1./backgroundExp/(relativeBkgUncert*relativeBkgUncert);
40 Double_t auxiliaryInf = backgroundExp*tau; //Given
41
42 Double_t P_Bi = TMath::BetaIncomplete(1./(1.+tau),mainInf,auxiliaryInf+1);
43 return P_Bi;
44
45/*
46Now, if instead the mean background level b in the signal region is
47specified, along with Gaussian rms sigb, then one can fake a Poisson
48sideband (see Linnemann, p. 35, converted to Cranmer's notation) by
49letting tau = b/(sigb*sigb) and y = b*tau. Thus, for example, if one
50has x=150 and b = 100 +/- 10, one then derives tau and y. Then one
51has the same two lines of ROOT calling BetaIncomplete and ErfInverse.
52Since I chose these numbers to revert to the previous example, we get
53the same answer:
54*/
55/*
56//GAUSSIAN FAKED AS POISSON EXAMPLE
57x = 150. //Given
58b = 100. //Given
59sigb = 10. //Given
60tau = b/(sigb*sigb)
61y = tau*b
62Z_Bi = TMath::BetaIncomplete(1./(1.+tau),x,y+1)
63S = sqrt(2)*TMath::ErfInverse(1 - 2*Z_Bi)
64
65*/
66
67}
68
69
71 // Expected P-value for s=0 in a ratio of Poisson means.
72 // Based on two expectations, a main measurement that might have signal
73 // and an auxiliarly measurement for the background that is signal free.
74 // The expected background in the auxiliary measurement is a factor
75 // tau larger than in the main measurement.
76
77 Double_t mainInf = signalExp+backgroundExp; //Given
78 Double_t auxiliaryInf = backgroundExp*tau; //Given
79
80 Double_t P_Bi = TMath::BetaIncomplete(1./(1.+tau),mainInf,auxiliaryInf+1);
81
82 return P_Bi;
83
84}
85
87 // P-value for s=0 in a ratio of Poisson means.
88 // Here the background and its uncertainty are provided directly and
89 // assumed to be from the double Poisson counting setup.
90 // Normally one would know tau directly, but here it is determiend from
91 // the background uncertainty. This is not strictly correct, but a useful
92 // approximation.
93
94 Double_t tau = 1./backgroundObs/(relativeBkgUncert*relativeBkgUncert);
95 Double_t auxiliaryInf = backgroundObs*tau; //Given
96
97
98 //SIDE BAND EXAMPLE
99 //See Eqn. (19) of Cranmer and pp. 36-37 of Linnemann.
100 Double_t P_Bi = TMath::BetaIncomplete(1./(1.+tau),mainObs,auxiliaryInf+1);
101
102 return P_Bi;
103
104}
105
106
108 // P-value for s=0 in a ratio of Poisson means.
109 // Based on two observations, a main measurement that might have signal
110 // and an auxiliarly measurement for the background that is signal free.
111 // The expected background in the auxiliary measurement is a factor
112 // tau larger than in the main measurement.
113
114 //SIDE BAND EXAMPLE
115 //See Eqn. (19) of Cranmer and pp. 36-37 of Linnemann.
116 Double_t P_Bi = TMath::BetaIncomplete(1./(1.+tau),mainObs,auxiliaryObs+1);
117
118 return P_Bi;
119
120}
121
123 // See BinomialExpP
124 return RooStats::PValueToSignificance( BinomialExpP(signalExp,backgroundExp,relativeBkgUncert) ) ;
125 }
126
128 // See BinomialWithTauExpP
129 return RooStats::PValueToSignificance( BinomialWithTauExpP(signalExp,backgroundExp,tau) ) ;
130}
131
132
134 // See BinomialObsP
135 return RooStats::PValueToSignificance( BinomialObsP(mainObs,backgroundObs,relativeBkgUncert) ) ;
136}
137
139 // See BinomialWithTauObsP
140 return RooStats::PValueToSignificance( BinomialWithTauObsP(mainObs,auxiliaryObs,tau) ) ;
141}
double Double_t
Definition: RtypesCore.h:55
Double_t BinomialWithTauExpZ(Double_t sExp, Double_t bExp, Double_t tau)
Double_t BinomialObsZ(Double_t nObs, Double_t bExp, Double_t fractionalBUncertainty)
Double_t BinomialWithTauObsZ(Double_t nObs, Double_t bExp, Double_t tau)
Double_t BinomialWithTauObsP(Double_t nObs, Double_t bExp, Double_t tau)
Double_t BinomialObsP(Double_t nObs, Double_t, Double_t fractionalBUncertainty)
Double_t BinomialWithTauExpP(Double_t sExp, Double_t bExp, Double_t tau)
Double_t BinomialExpZ(Double_t sExp, Double_t bExp, Double_t fractionalBUncertainty)
Double_t BinomialExpP(Double_t sExp, Double_t bExp, Double_t fractionalBUncertainty)
Double_t PValueToSignificance(Double_t pvalue)
returns one-sided significance corresponding to a p-value
Definition: RooStatsUtils.h:50
Double_t BetaIncomplete(Double_t x, Double_t a, Double_t b)
Calculates the incomplete Beta-function.
Definition: TMath.cxx:2082