Logo ROOT   6.08/07
Reference Guide
NeymanConstruction.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
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 #ifndef ROOSTATS_NeymanConstruction
12 #define ROOSTATS_NeymanConstruction
13 
14 
15 #ifndef ROOT_Rtypes
16 #include "Rtypes.h"
17 #endif
18 
19 #ifndef ROOSTATS_IntervalCalculator
21 #endif
22 
24 #include "RooStats/ModelConfig.h"
27 
28 #include "RooAbsData.h"
29 #include "RooAbsPdf.h"
30 #include "RooArgSet.h"
31 #include "TList.h"
32 
33 class RooAbsData;
34 
35 namespace RooStats {
36 
37  class ConfInterval;
38 
39 
40 /**
41 
42  \ingroup Roostats
43 
44 NeymanConstruction is a concrete implementation of the NeymanConstruction interface that, as the name suggests, performs a NeymanConstruction. It produces a RooStats::PointSetInterval, which is a concrete implementation of the ConfInterval interface.
45 
46 The Neyman Construction is not a uniquely defined statistical technique, it requires that one specify an ordering rule or ordering principle, which is usually incoded by choosing a specific test statistic and limits of integration (corresponding to upper/lower/central limits). As a result, this class must be configured with the corresponding information before it can produce an interval. Common configurations, such as the Feldman-Cousins approach, can be enforced by other light weight classes.
47 
48 The Neyman Construction considers every point in the parameter space independently, no assumptions are made that the interval is connected or of a particular shape. As a result, the PointSetInterval class is used to represent the result. The user indicate which points in the parameter space to perform the constrution by providing a PointSetInterval instance with the desired points.
49 
50 This class is fairly light weight, because the choice of parameter points to be considered is factorized and so is the creation of the sampling distribution of the test statistic (which is done by a concrete class implementing the DistributionCreator interface). As a result, this class basically just drives the construction by:
51 
52 * using a DistributionCreator to create the SamplingDistribution of a user-defined test statistic for each parameter point of interest,
53 * defining the acceptance region in the data by finding the thresholds on the test statistic such that the integral of the sampling distribution is of the appropriate size and consistent with the limits of integration (eg. upper/lower/central limits),
54 * and finally updating the PointSetInterval based on whether the value of the test statistic evaluated on the data are in the acceptance region.
55 
56 */
57 
59 
60  public:
61 
62  /// NeymanConstruction();
64 
65  virtual ~NeymanConstruction();
66 
67  /// Main interface to get a ConfInterval (will be a PointSetInterval)
68  virtual PointSetInterval* GetInterval() const;
69 
70  /// in addition to interface we also need:
71  /// Set the TestStatSampler (eg. ToyMC or FFT, includes choice of TestStatistic)
73  /// fLeftSideTailFraction*fSize defines lower edge of acceptance region.
74  /// Unified limits use 0, central limits use 0.5,
75  /// for upper/lower limits it is 0/1 depends on sign of test statistic w.r.t. parameter
76  void SetLeftSideTailFraction(Double_t leftSideFraction = 0.) {fLeftSideFraction = leftSideFraction;}
77 
78  /// User-defined set of points to test
79  void SetParameterPointsToTest(RooAbsData& pointsToTest) {
80  fPointsToTest = &pointsToTest;
81  fConfBelt = new ConfidenceBelt("ConfBelt",pointsToTest);
82  }
83  /// This class can make regularly spaced scans based on range stored in RooRealVars.
84  /// Choose number of steps for a rastor scan (common for each dimension)
85  /// void SetNumSteps(Int_t);
86  /// This class can make regularly spaced scans based on range stored in RooRealVars.
87  /// Choose number of steps for a rastor scan (specific for each dimension)
88  /// void SetNumSteps(std::map<RooAbsArg, Int_t>)
89 
90  /// Get the size of the test (eg. rate of Type I error)
91  virtual Double_t Size() const {return fSize;}
92 
93  /// Get the Confidence level for the test
94  virtual Double_t ConfidenceLevel() const {return 1.-fSize;}
95 
96  /// Set ModelConfig
97  virtual void SetModel(const ModelConfig &model) {fModel = model;}
98 
99  /// Set the DataSet
100  virtual void SetData(RooAbsData& data) { fData = data; }
101 
102  /// Set the Pdf, add to the the workspace if not already there
103  virtual void SetPdf(RooAbsPdf& /*pdf*/) {
104  std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
105  }
106 
107  /// specify the parameters of interest in the interval
108  virtual void SetParameters(const RooArgSet& /*set*/) {
109  std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
110  }
111 
112  /// specify the nuisance parameters (eg. the rest of the parameters)
113  virtual void SetNuisanceParameters(const RooArgSet& /*set*/) {
114  std::cout << "DEPRECATED, use ModelConfig"<<std::endl;
115  }
116 
117  /// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
118  virtual void SetTestSize(Double_t size) {fSize = size;}
119  /// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
120  virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
121 
122  /// get confidence belt
124 
125  /// adaptive sampling algorithm to speed up interval caculation
126  void UseAdaptiveSampling(bool flag=true){fAdaptiveSampling=flag;}
127 
128  /// give user ability to ask for more toys
130 
131  /// save teh confidence belt to a file
132  void SaveBeltToFile(bool flag=true){
133  fSaveBeltToFile = flag;
134  if(flag) fCreateBelt = true;
135  }
136  /// should create confidence belt
137  void CreateConfBelt(bool flag=true){fCreateBelt = flag;}
138 
139  /// Returns instance of TestStatSampler. Use to change properties of
140  /// TestStatSampler, e.g. GetTestStatSampler.SetTestSize(Double_t size);
142 
143 
144  private:
145 
146  Double_t fSize; /// size of the test (eg. specified rate of Type I error)
147  RooAbsData& fData; /// data set
149  /*
150  RooAbsPdf * fPdf; // common PDF
151  mutable RooArgSet fPOI; // RooArgSet specifying parameters of interest for interval
152  RooArgSet fNuisParams;// RooArgSet specifying nuisance parameters for interval
153  */
154 
159  bool fAdaptiveSampling; // controls use of adaptive sampling algorithm
160  Double_t fAdditionalNToysFactor; // give user ability to ask for more toys
161  bool fSaveBeltToFile; // controls use if ConfidenceBelt should be saved to a TFile
162  bool fCreateBelt; // controls use if ConfidenceBelt should be saved to a TFile
163 
164  protected:
165  ClassDef(NeymanConstruction,1) // Interface for tools setting limits (producing confidence intervals)
166  };
167 }
168 
169 
170 #endif
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:52
ConfidenceBelt * GetConfidenceBelt()
get confidence belt
IntervalCalculator is an interface class for a tools which produce RooStats ConfIntervals.
virtual void SetTestSize(Double_t size)
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval) ...
virtual PointSetInterval * GetInterval() const
Main interface to get a ConfInterval (will be a PointSetInterval)
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
NeymanConstruction(RooAbsData &data, ModelConfig &model)
NeymanConstruction();.
virtual void SetNuisanceParameters(const RooArgSet &)
specify the nuisance parameters (eg. the rest of the parameters)
void SetParameterPointsToTest(RooAbsData &pointsToTest)
User-defined set of points to test.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void SetPdf(RooAbsPdf &)
Set the Pdf, add to the the workspace if not already there.
void AdditionalNToysFactor(double fact)
give user ability to ask for more toys
ConfidenceBelt is a concrete implementation of the ConfInterval interface.
virtual ~NeymanConstruction()
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt; ...
virtual void SetParameters(const RooArgSet &)
specify the parameters of interest in the interval
RooAbsData & fData
size of the test (eg. specified rate of Type I error)
virtual void SetModel(const ModelConfig &model)
Set ModelConfig.
virtual Double_t Size() const
This class can make regularly spaced scans based on range stored in RooRealVars.
ModelConfig & fModel
data set
virtual Double_t ConfidenceLevel() const
Get the Confidence level for the test.
virtual void SetData(RooAbsData &data)
Set the DataSet.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
void SetTestStatSampler(TestStatSampler &sampler)
in addition to interface we also need: Set the TestStatSampler (eg.
void UseAdaptiveSampling(bool flag=true)
adaptive sampling algorithm to speed up interval caculation
Namespace for the RooStats classes.
Definition: Asimov.h:20
PointSetInterval is a concrete implementation of the ConfInterval interface.
double Double_t
Definition: RtypesCore.h:55
void CreateConfBelt(bool flag=true)
should create confidence belt
TestStatSampler * GetTestStatSampler(void)
Returns instance of TestStatSampler.
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
void SetLeftSideTailFraction(Double_t leftSideFraction=0.)
fLeftSideTailFraction*fSize defines lower edge of acceptance region.
void SaveBeltToFile(bool flag=true)
save teh confidence belt to a file
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval) ...