Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "Rtypes.h"
16
18
23
24#include "RooAbsData.h"
25#include "RooAbsPdf.h"
26#include "RooArgSet.h"
27
28#include <map>
29
30class RooAbsData;
31
32namespace RooStats {
33
34 class ConfInterval;
35
37
38 public:
39
40 /// NeymanConstruction();
42
43 ~NeymanConstruction() override;
44
45 /// Main interface to get a ConfInterval (will be a PointSetInterval)
46 PointSetInterval* GetInterval() const override;
47
48 /// in addition to interface we also need:
49 /// Set the TestStatSampler (eg. ToyMC or FFT, includes choice of TestStatistic)
51 /// fLeftSideTailFraction*fSize defines lower edge of acceptance region.
52 /// Unified limits use 0, central limits use 0.5,
53 /// for upper/lower limits it is 0/1 depends on sign of test statistic w.r.t. parameter
54 void SetLeftSideTailFraction(double leftSideFraction = 0.) {fLeftSideFraction = leftSideFraction;}
55
56 /// User-defined set of points to test
58 fPointsToTest = &pointsToTest;
59 fConfBelt = new ConfidenceBelt("ConfBelt",pointsToTest);
60 }
61 /// This class can make regularly spaced scans based on range stored in RooRealVars.
62 /// Choose number of steps for a rastor scan (common for each dimension)
63 /// void SetNumSteps(Int_t);
64 /// This class can make regularly spaced scans based on range stored in RooRealVars.
65 /// Choose number of steps for a rastor scan (specific for each dimension)
66 /// void SetNumSteps(std::map<RooAbsArg, Int_t>)
67
68 /// Get the size of the test (eg. rate of Type I error)
69 double Size() const override {return fSize;}
70
71 /// Get the Confidence level for the test
72 double ConfidenceLevel() const override {return 1.-fSize;}
73
74 /// Set ModelConfig
75 void SetModel(const ModelConfig &model) override {fModel = model;}
76
77 /// Set the DataSet
78 void SetData(RooAbsData& data) override { fData = data; }
79
80 /// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
81 void SetTestSize(double size) override {fSize = size;}
82 /// set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
83 void SetConfidenceLevel(double cl) override {fSize = 1.-cl;}
84
85 /// Get confidence belt. This requires that CreateConfBelt() has been called.
87
88 /// adaptive sampling algorithm to speed up interval calculation
89 void UseAdaptiveSampling(bool flag=true){fAdaptiveSampling=flag;}
90
91 /// give user ability to ask for more toys
93
94 /// save the confidence belt to a file
95 void SaveBeltToFile(bool flag=true){
96 fSaveBeltToFile = flag;
97 if(flag) fCreateBelt = true;
98 }
99 /// should create confidence belt
100 void CreateConfBelt(bool flag=true){fCreateBelt = flag;}
101
102 /// Returns instance of TestStatSampler. Use to change properties of
103 /// TestStatSampler, e.g. GetTestStatSampler.SetTestSize(double size);
105
106
107 private:
108
109 double fSize; ///< size of the test (eg. specified rate of Type I error)
110 RooAbsData& fData; ///< data set
112
117 bool fAdaptiveSampling; ///< controls use of adaptive sampling algorithm
118 double fAdditionalNToysFactor; ///< give user ability to ask for more toys
119 bool fSaveBeltToFile; ///< controls use if ConfidenceBelt should be saved to a TFile
120 bool fCreateBelt; ///< controls use if ConfidenceBelt should be saved to a TFile
121
122 protected:
123 ClassDefOverride(NeymanConstruction,1) ///< Interface for tools setting limits (producing confidence intervals)
124 };
125}
126
127
128#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
ConfidenceBelt is a concrete implementation of the ConfInterval interface.
IntervalCalculator is an interface class for a tools which produce RooStats ConfIntervals.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition ModelConfig.h:35
NeymanConstruction is a concrete implementation of the NeymanConstruction interface that,...
bool fAdaptiveSampling
controls use of adaptive sampling algorithm
double fSize
size of the test (eg. specified rate of Type I error)
TestStatSampler * GetTestStatSampler(void)
Returns instance of TestStatSampler.
PointSetInterval * GetInterval() const override
Main interface to get a ConfInterval (will be a PointSetInterval)
void SetTestSize(double size) override
set the size of the test (rate of Type I error) ( Eg. 0.05 for a 95% Confidence Interval)
void SaveBeltToFile(bool flag=true)
save the confidence belt to a file
void SetConfidenceLevel(double cl) override
set the confidence level for the interval (eg. 0.95 for a 95% Confidence Interval)
ConfidenceBelt * GetConfidenceBelt()
Get confidence belt. This requires that CreateConfBelt() has been called.
~NeymanConstruction() override
default constructor if(fOwnsWorkspace && fWS) delete fWS; if(fConfBelt) delete fConfBelt;
void SetTestStatSampler(TestStatSampler &sampler)
in addition to interface we also need: Set the TestStatSampler (eg.
void SetLeftSideTailFraction(double leftSideFraction=0.)
fLeftSideTailFraction*fSize defines lower edge of acceptance region.
double ConfidenceLevel() const override
Get the Confidence level for the test.
void UseAdaptiveSampling(bool flag=true)
adaptive sampling algorithm to speed up interval calculation
void AdditionalNToysFactor(double fact)
give user ability to ask for more toys
bool fSaveBeltToFile
controls use if ConfidenceBelt should be saved to a TFile
double Size() const override
This class can make regularly spaced scans based on range stored in RooRealVars.
void CreateConfBelt(bool flag=true)
should create confidence belt
void SetParameterPointsToTest(RooAbsData &pointsToTest)
User-defined set of points to test.
void SetData(RooAbsData &data) override
Set the DataSet.
double fAdditionalNToysFactor
give user ability to ask for more toys
void SetModel(const ModelConfig &model) override
Set ModelConfig.
bool fCreateBelt
controls use if ConfidenceBelt should be saved to a TFile
PointSetInterval is a concrete implementation of the ConfInterval interface.
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
Namespace for the RooStats classes.
Definition Asimov.h:19