Logo ROOT  
Reference Guide
HypoTestResult.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke, Sven Kreiss
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 #ifndef ROOSTATS_HypoTestResult
11 #define ROOSTATS_HypoTestResult
12 
13 #include "RooStats/RooStatsUtils.h"
15 
16 #include "TNamed.h"
17 
18 #include <memory>
19 
20 namespace RooStats {
21 
22  class HypoTestResult : public TNamed {
23 
24  public:
25 
26  /// default constructor
27  explicit HypoTestResult(const char* name = 0);
28 
29  /// copy constructor
30  HypoTestResult(const HypoTestResult& other);
31 
32  /// constructor from name, null and alternate p values
33  HypoTestResult(const char* name, Double_t nullp, Double_t altp);
34 
35  /// destructor
36  virtual ~HypoTestResult();
37 
38  /// assignment operator
39  HypoTestResult & operator=(const HypoTestResult& other);
40 
41  /// add values from another HypoTestResult
42  virtual void Append(const HypoTestResult *other);
43 
44  /// Return p-value for null hypothesis
45  virtual Double_t NullPValue() const { return fNullPValue; }
46 
47  /// Return p-value for alternate hypothesis
48  virtual Double_t AlternatePValue() const { return fAlternatePValue; }
49 
50  /// Convert NullPValue into a "confidence level"
51  virtual Double_t CLb() const { return !fBackgroundIsAlt ? NullPValue() : AlternatePValue(); }
52 
53  /// Convert AlternatePValue into a "confidence level"
54  virtual Double_t CLsplusb() const { return !fBackgroundIsAlt ? AlternatePValue() : NullPValue(); }
55 
56  /// \f$CL_{s}\f$ is simply \f$CL_{s+b}/CL_{b}\f$ (not a method, but a quantity)
57  virtual Double_t CLs() const {
58  double thisCLb = CLb();
59  if (thisCLb == 0) {
60  std::cout << "Error: Cannot compute CLs because CLb = 0. Returning CLs = -1\n";
61  return -1;
62  }
63  double thisCLsb = CLsplusb();
64  return thisCLsb / thisCLb;
65  }
66 
67  /// familiar name for the Null p-value in terms of 1-sided Gaussian significance
69 
74  RooDataSet* GetFitInfo() const { return fFitInfo.get(); }
77  Bool_t HasTestStatisticData(void) const;
78 
83  void SetFitInfo(RooDataSet* d) { fFitInfo.reset(d); }
84  void SetTestStatisticData(const Double_t tsd);
85  void SetAllTestStatisticsData(const RooArgList* tsd);
86 
89 
91  Bool_t GetBackGroundIsAlt(void) const { return fBackgroundIsAlt; }
92 
93  /// The error on the "confidence level" of the null hypothesis
94  Double_t CLbError() const;
95 
96  /// The error on the "confidence level" of the alternative hypothesis
97  Double_t CLsplusbError() const;
98 
99  /// The error on the ratio \f$CL_{s+b}/CL_{b}\f$
100  Double_t CLsError() const;
101 
102  /// The error on the Null p-value
103  Double_t NullPValueError() const;
104 
105  /// The error on the significance, computed from NullPValueError via error propagation
106  Double_t SignificanceError() const;
107 
108 
109  void Print(const Option_t* = "") const;
110 
111  private:
112  void UpdatePValue(const SamplingDistribution* distr, Double_t &pvalue, Double_t &perror, Bool_t pIsRightTail);
113 
114 
115  protected:
116 
117  mutable Double_t fNullPValue; // p-value for the null hypothesis (small number means disfavoured)
118  mutable Double_t fAlternatePValue; // p-value for the alternate hypothesis (small number means disfavoured)
119  mutable Double_t fNullPValueError; // error of p-value for the null hypothesis (small number means disfavoured)
120  mutable Double_t fAlternatePValueError; // error of p-value for the alternate hypothesis (small number means disfavoured)
121  Double_t fTestStatisticData; // result of the test statistic evaluated on data
122  const RooArgList* fAllTestStatisticsData; // for the case of multiple test statistics, holds all the results
127  std::unique_ptr<RooDataSet> fFitInfo;
130 
131  ClassDef(HypoTestResult,4) // Base class to represent results of a hypothesis test
132 
133  };
134 }
135 
136 
137 #endif
l
auto * l
Definition: textangle.C:4
RooStats::HypoTestResult::NullPValueError
Double_t NullPValueError() const
The error on the Null p-value.
Definition: HypoTestResult.cxx:263
RooStats::HypoTestResult::Significance
virtual Double_t Significance() const
familiar name for the Null p-value in terms of 1-sided Gaussian significance
Definition: HypoTestResult.h:68
RooStats::HypoTestResult::SetTestStatisticData
void SetTestStatisticData(const Double_t tsd)
Definition: HypoTestResult.cxx:224
RooStats::HypoTestResult::~HypoTestResult
virtual ~HypoTestResult()
destructor
Definition: HypoTestResult.cxx:126
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooStats::HypoTestResult::SetAltDetailedOutput
void SetAltDetailedOutput(RooDataSet *d)
Definition: HypoTestResult.h:81
Option_t
const char Option_t
Definition: RtypesCore.h:66
RooStats::SamplingDistribution
This class simply holds a sampling distribution of some test statistic.
Definition: SamplingDistribution.h:28
RooStats::HypoTestResult::SetAllTestStatisticsData
void SetAllTestStatisticsData(const RooArgList *tsd)
Definition: HypoTestResult.cxx:233
RooStats::HypoTestResult::HypoTestResult
HypoTestResult(const char *name=0)
default constructor
Definition: HypoTestResult.cxx:77
RooStats::HypoTestResult::GetNullDistribution
SamplingDistribution * GetNullDistribution(void) const
Definition: HypoTestResult.h:70
RooStats::HypoTestResult::Print
void Print(const Option_t *="") const
Print out some information about the results Note: use Alt/Null labels for the hypotheses here as the...
Definition: HypoTestResult.cxx:339
RooStats::HypoTestResult::fAltDistr
SamplingDistribution * fAltDistr
Definition: HypoTestResult.h:124
RooStats::HypoTestResult::fPValueIsRightTail
Bool_t fPValueIsRightTail
Definition: HypoTestResult.h:128
RooStats::HypoTestResult::NullPValue
virtual Double_t NullPValue() const
Return p-value for null hypothesis.
Definition: HypoTestResult.h:45
RooStats::HypoTestResult::GetTestStatisticData
Double_t GetTestStatisticData(void) const
Definition: HypoTestResult.h:75
TNamed.h
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooStats::HypoTestResult::GetPValueIsRightTail
Bool_t GetPValueIsRightTail(void) const
Definition: HypoTestResult.h:88
RooStats::HypoTestResult::SetNullDetailedOutput
void SetNullDetailedOutput(RooDataSet *d)
Definition: HypoTestResult.h:82
RooStats::HypoTestResult::GetAltDetailedOutput
RooDataSet * GetAltDetailedOutput(void) const
Definition: HypoTestResult.h:73
bool
RooStats::HypoTestResult::SetPValueIsRightTail
void SetPValueIsRightTail(Bool_t pr)
Definition: HypoTestResult.cxx:248
RooStats::PValueToSignificance
Double_t PValueToSignificance(Double_t pvalue)
returns one-sided significance corresponding to a p-value
Definition: RooStatsUtils.h:51
RooStats::HypoTestResult::SetAltDistribution
void SetAltDistribution(SamplingDistribution *alt)
Definition: HypoTestResult.cxx:210
RooStats::HypoTestResult::fAlternatePValueError
Double_t fAlternatePValueError
Definition: HypoTestResult.h:120
RooStats::HypoTestResult::GetNullDetailedOutput
RooDataSet * GetNullDetailedOutput(void) const
Definition: HypoTestResult.h:72
RooStats::HypoTestResult::SetFitInfo
void SetFitInfo(RooDataSet *d)
Definition: HypoTestResult.h:83
RooStats::HypoTestResult::operator=
HypoTestResult & operator=(const HypoTestResult &other)
assignment operator
Definition: HypoTestResult.cxx:140
RooStats::HypoTestResult::CLsplusbError
Double_t CLsplusbError() const
The error on the "confidence level" of the alternative hypothesis.
Definition: HypoTestResult.cxx:279
RooStats::HypoTestResult::fAlternatePValue
Double_t fAlternatePValue
Definition: HypoTestResult.h:118
RooStats::HypoTestResult::fNullDetailedOutput
RooDataSet * fNullDetailedOutput
Definition: HypoTestResult.h:125
RooStats::HypoTestResult::Append
virtual void Append(const HypoTestResult *other)
add values from another HypoTestResult
Definition: HypoTestResult.cxx:171
RooStats::HypoTestResult::fTestStatisticData
Double_t fTestStatisticData
Definition: HypoTestResult.h:121
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooStats::HypoTestResult::fNullDistr
SamplingDistribution * fNullDistr
Definition: HypoTestResult.h:123
RooStats::HypoTestResult::fAllTestStatisticsData
const RooArgList * fAllTestStatisticsData
Definition: HypoTestResult.h:122
RooStats::HypoTestResult::SetBackgroundAsAlt
void SetBackgroundAsAlt(Bool_t l=kTRUE)
Definition: HypoTestResult.h:90
RooStats::HypoTestResult::fNullPValueError
Double_t fNullPValueError
Definition: HypoTestResult.h:119
RooStats::HypoTestResult::UpdatePValue
void UpdatePValue(const SamplingDistribution *distr, Double_t &pvalue, Double_t &perror, Bool_t pIsRightTail)
updates the pvalue if sufficient data is available
Definition: HypoTestResult.cxx:316
RooStats::HypoTestResult::fAltDetailedOutput
RooDataSet * fAltDetailedOutput
Definition: HypoTestResult.h:126
RooStats::HypoTestResult::CLsError
Double_t CLsError() const
The error on the ratio .
Definition: HypoTestResult.cxx:298
RooStats::HypoTestResult::AlternatePValue
virtual Double_t AlternatePValue() const
Return p-value for alternate hypothesis.
Definition: HypoTestResult.h:48
RooStats::HypoTestResult::CLbError
Double_t CLbError() const
The error on the "confidence level" of the null hypothesis.
Definition: HypoTestResult.cxx:273
RooStats::HypoTestResult::GetAltDistribution
SamplingDistribution * GetAltDistribution(void) const
Definition: HypoTestResult.h:71
RooStats::HypoTestResult::fBackgroundIsAlt
Bool_t fBackgroundIsAlt
Definition: HypoTestResult.h:129
SamplingDistribution.h
RooStats::HypoTestResult::GetAllTestStatisticsData
const RooArgList * GetAllTestStatisticsData(void) const
Definition: HypoTestResult.h:76
RooStatsUtils.h
Double_t
double Double_t
Definition: RtypesCore.h:59
RooStats::HypoTestResult::HasTestStatisticData
Bool_t HasTestStatisticData(void) const
Definition: HypoTestResult.cxx:257
RooStats::HypoTestResult::GetFitInfo
RooDataSet * GetFitInfo() const
Definition: HypoTestResult.h:74
RooStats
Namespace for the RooStats classes.
Definition: Asimov.h:19
RooStats::HypoTestResult::CLs
virtual Double_t CLs() const
is simply (not a method, but a quantity)
Definition: HypoTestResult.h:57
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooStats::HypoTestResult
HypoTestResult is a base class for results from hypothesis tests.
Definition: HypoTestResult.h:22
name
char name[80]
Definition: TGX11.cxx:110
d
#define d(i)
Definition: RSha256.hxx:102
RooDataSet
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
RooStats::HypoTestResult::GetBackGroundIsAlt
Bool_t GetBackGroundIsAlt(void) const
Definition: HypoTestResult.h:91
RooStats::HypoTestResult::fFitInfo
std::unique_ptr< RooDataSet > fFitInfo
Definition: HypoTestResult.h:127
RooStats::HypoTestResult::CLsplusb
virtual Double_t CLsplusb() const
Convert AlternatePValue into a "confidence level".
Definition: HypoTestResult.h:54
RooStats::HypoTestResult::fNullPValue
Double_t fNullPValue
Definition: HypoTestResult.h:117
RooStats::HypoTestResult::SignificanceError
Double_t SignificanceError() const
The error on the significance, computed from NullPValueError via error propagation.
Definition: HypoTestResult.cxx:286
RooStats::HypoTestResult::SetNullDistribution
void SetNullDistribution(SamplingDistribution *null)
Definition: HypoTestResult.cxx:217
RooStats::HypoTestResult::CLb
virtual Double_t CLb() const
Convert NullPValue into a "confidence level".
Definition: HypoTestResult.h:51