Logo ROOT   6.10/09
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 
11 
12 
13 
14 #ifndef ROOSTATS_HypoTestResult
15 #define ROOSTATS_HypoTestResult
16 
17 #include "TNamed.h"
18 
19 #include "RooStats/RooStatsUtils.h"
20 
22 
23 namespace RooStats {
24 
25  class HypoTestResult : public TNamed {
26 
27  public:
28 
29  /// default constructor
30  explicit HypoTestResult(const char* name = 0);
31 
32  /// copy constructor
33  HypoTestResult(const HypoTestResult& other);
34 
35  /// constructor from name, null and alternate p values
36  HypoTestResult(const char* name, Double_t nullp, Double_t altp);
37 
38  /// destructor
39  virtual ~HypoTestResult();
40 
41  /// assignment operator
42  HypoTestResult & operator=(const HypoTestResult& other);
43 
44  /// add values from another HypoTestResult
45  virtual void Append(const HypoTestResult *other);
46 
47  /// Return p-value for null hypothesis
48  virtual Double_t NullPValue() const { return fNullPValue; }
49 
50  /// Return p-value for alternate hypothesis
51  virtual Double_t AlternatePValue() const { return fAlternatePValue; }
52 
53  /// Convert NullPValue into a "confidence level"
54  virtual Double_t CLb() const { return !fBackgroundIsAlt ? NullPValue() : AlternatePValue(); }
55 
56  /// Convert AlternatePValue into a "confidence level"
57  virtual Double_t CLsplusb() const { return !fBackgroundIsAlt ? AlternatePValue() : NullPValue(); }
58 
59  /// \f$CL_{s}\f$ is simply \f$CL_{s+b}/CL_{b}\f$ (not a method, but a quantity)
60  virtual Double_t CLs() const {
61  double thisCLb = CLb();
62  if (thisCLb == 0) {
63  std::cout << "Error: Cannot compute CLs because CLb = 0. Returning CLs = -1\n";
64  return -1;
65  }
66  double thisCLsb = CLsplusb();
67  return thisCLsb / thisCLb;
68  }
69 
70  /// familiar name for the Null p-value in terms of 1-sided Gaussian significance
72 
77  RooDataSet* GetFitInfo(void) const { return fFitInfo; }
80  Bool_t HasTestStatisticData(void) const;
81 
86  void SetFitInfo(RooDataSet* d) { fFitInfo = d; }
87  void SetTestStatisticData(const Double_t tsd);
88  void SetAllTestStatisticsData(const RooArgList* tsd);
89 
92 
94  Bool_t GetBackGroundIsAlt(void) const { return fBackgroundIsAlt; }
95 
96  /// The error on the "confidence level" of the null hypothesis
97  Double_t CLbError() const;
98 
99  /// The error on the "confidence level" of the alternative hypothesis
100  Double_t CLsplusbError() const;
101 
102  /// The error on the ratio \f$CL_{s+b}/CL_{b}\f$
103  Double_t CLsError() const;
104 
105  /// The error on the Null p-value
106  Double_t NullPValueError() const;
107 
108  /// The error on the significance, computed from NullPValueError via error propagation
109  Double_t SignificanceError() const;
110 
111 
112  void Print(const Option_t* = "") const;
113 
114  private:
115  void UpdatePValue(const SamplingDistribution* distr, Double_t &pvalue, Double_t &perror, Bool_t pIsRightTail);
116 
117 
118  protected:
119 
120  mutable Double_t fNullPValue; // p-value for the null hypothesis (small number means disfavoured)
121  mutable Double_t fAlternatePValue; // p-value for the alternate hypothesis (small number means disfavoured)
122  mutable Double_t fNullPValueError; // error of p-value for the null hypothesis (small number means disfavoured)
123  mutable Double_t fAlternatePValueError; // error of p-value for the alternate hypothesis (small number means disfavoured)
124  Double_t fTestStatisticData; // result of the test statistic evaluated on data
125  const RooArgList* fAllTestStatisticsData; // for the case of multiple test statistics, holds all the results
133 
134  ClassDef(HypoTestResult,3) // Base class to represent results of a hypothesis test
135 
136  };
137 }
138 
139 
140 #endif
Bool_t HasTestStatisticData(void) const
void SetBackgroundAsAlt(Bool_t l=kTRUE)
void SetAltDistribution(SamplingDistribution *alt)
void SetFitInfo(RooDataSet *d)
virtual Double_t CLb() const
Convert NullPValue into a "confidence level".
const char Option_t
Definition: RtypesCore.h:62
void Print(const Option_t *="") const
Print out some information about the results Note: use Alt/Null labels for the hypotheses here as the...
RooDataSet * GetAltDetailedOutput(void) const
const RooArgList * fAllTestStatisticsData
RooDataSet * GetFitInfo(void) const
Double_t PValueToSignificance(Double_t pvalue)
returns one-sided significance corresponding to a p-value
Definition: RooStatsUtils.h:44
HypoTestResult is a base class for results from hypothesis tests.
Double_t NullPValueError() const
The error on the Null p-value.
HypoTestResult & operator=(const HypoTestResult &other)
assignment operator
RooDataSet * fNullDetailedOutput
void UpdatePValue(const SamplingDistribution *distr, Double_t &pvalue, Double_t &perror, Bool_t pIsRightTail)
updates the pvalue if sufficient data is available
bool Bool_t
Definition: RtypesCore.h:59
SamplingDistribution * GetAltDistribution(void) const
Double_t CLbError() const
The error on the "confidence level" of the null hypothesis.
virtual Double_t Significance() const
familiar name for the Null p-value in terms of 1-sided Gaussian significance
null_t< F > null()
#define ClassDef(name, id)
Definition: Rtypes.h:297
Double_t CLsError() const
The error on the ratio .
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Bool_t GetPValueIsRightTail(void) const
const RooArgList * GetAllTestStatisticsData(void) const
void SetAllTestStatisticsData(const RooArgList *tsd)
virtual ~HypoTestResult()
destructor
virtual Double_t NullPValue() const
Return p-value for null hypothesis.
Double_t GetTestStatisticData(void) const
SamplingDistribution * fAltDistr
void SetAltDetailedOutput(RooDataSet *d)
SamplingDistribution * GetNullDistribution(void) const
TLine * l
Definition: textangle.C:4
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
void SetTestStatisticData(const Double_t tsd)
This class simply holds a sampling distribution of some test statistic.
HypoTestResult(const char *name=0)
default constructor
virtual void Append(const HypoTestResult *other)
add values from another HypoTestResult
virtual Double_t CLs() const
is simply (not a method, but a quantity)
virtual Double_t AlternatePValue() const
Return p-value for alternate hypothesis.
void SetPValueIsRightTail(Bool_t pr)
virtual Double_t CLsplusb() const
Convert AlternatePValue into a "confidence level".
RooDataSet * GetNullDetailedOutput(void) const
Namespace for the RooStats classes.
Definition: Asimov.h:20
SamplingDistribution * fNullDistr
double Double_t
Definition: RtypesCore.h:55
Double_t CLsplusbError() const
The error on the "confidence level" of the alternative hypothesis.
void SetNullDetailedOutput(RooDataSet *d)
Double_t SignificanceError() const
The error on the significance, computed from NullPValueError via error propagation.
RooDataSet * fAltDetailedOutput
Bool_t GetBackGroundIsAlt(void) const
const Bool_t kTRUE
Definition: RtypesCore.h:91
void SetNullDistribution(SamplingDistribution *null)