Logo ROOT  
Reference Guide
ProfileLikelihoodTestStat.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
3// Additional Contributions: Giovanni Petrucciani
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#ifndef ROOSTATS_ProfileLikelihoodTestStat
13#define ROOSTATS_ProfileLikelihoodTestStat
14
15
16#include "Rtypes.h"
17
19
20
21#include "RooRealVar.h"
22
23#include "RooNLLVar.h"
24
26
28
29
30namespace RooStats {
31
33
35
36 public:
38 // Proof constructor. Do not use.
39 fPdf = 0;
40 fNll = 0;
42 fLastData = 0;
44 fSigned = false;
47 fDetailedOutput = NULL;
49
50 fVarName = "Profile Likelihood Ratio";
51 fReuseNll = false;
56
57 }
59 fPdf = &pdf;
60 fNll = 0;
62 fLastData = 0;
64 fSigned = false;
67 fDetailedOutput = NULL;
69
70 fVarName = "Profile Likelihood Ratio";
71 fReuseNll = false;
74 // avoid default tolerance to be too small (1. is default in RooMinimizer)
77 }
78
80 if(fNll) delete fNll;
83 }
84
85 //LM use default copy constructor and assignment copying the pointers. Is this what we want ?
86
87 void SetOneSided(Bool_t flag=true) {fLimitType = (flag ? oneSided : twoSided);}
89 void SetSigned(Bool_t flag=true) {fSigned = flag;} // +/- t_mu instead of t_mu>0 with one-sided settings
90 //void SetOneSidedDiscovery(Bool_t flag=true) {fOneSidedDiscovery = flag;}
91
92 bool IsTwoSided() const { return fLimitType == twoSided; }
94
95 static void SetAlwaysReuseNLL(Bool_t flag);
96
97 void SetReuseNLL(Bool_t flag) { fReuseNll = flag ; }
98 void SetLOffset(Bool_t flag=kTRUE) { fLOffset = flag ; }
99
100 void SetMinimizer(const char* minimizer){ fMinimizer=minimizer;}
101 void SetStrategy(Int_t strategy){fStrategy=strategy;}
102 void SetTolerance(double tol){fTolerance=tol;}
103 void SetPrintLevel(Int_t printlevel){fPrintLevel=printlevel;}
104
105 // Main interface to evaluate the test statistic on a dataset
106 virtual Double_t Evaluate(RooAbsData& data, RooArgSet& paramsOfInterest) {
107 return EvaluateProfileLikelihood(0, data, paramsOfInterest);
108 }
109
110 // evaluate the profile likelihood ratio (type = 0) or the minimum of likelihood (type=1) or the conditional LL (type = 2)
111 virtual Double_t EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet & paramsOfInterest);
112
113 virtual void EnableDetailedOutput( bool e=true, bool withErrorsAndPulls=false ) {
115 fDetailedOutputWithErrorsAndPulls = withErrorsAndPulls;
116 delete fDetailedOutput;
117 fDetailedOutput = NULL;
118 }
119 virtual const RooArgSet* GetDetailedOutput(void) const {
120 // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
121 // The returned RooArgSet contains the following:
122 // <ul>
123 // <li> the minimum nll, fitstatus and convergence quality for each fit </li>
124 // <li> for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored </li>
125 // </ul>
126 return fDetailedOutput;
127 }
128
129 // set the conditional observables which will be used when creating the NLL
130 // so the pdf's will not be normalized on the conditional observables when computing the NLL
132
133 // set the global observables which will be used when creating the NLL
134 // so the constraint pdf's will be normalized correctly on the global observables when computing the NLL
136
137 virtual void SetVarName(const char* name) { fVarName = name; }
138 virtual const TString GetVarName() const {return fVarName;}
139
140 virtual RooAbsPdf * GetPdf() const { return fPdf; }
141
142
143 // const bool PValueIsRightTail(void) { return false; } // overwrites default
144
145 private:
146
148
149 private:
150
155 // Double_t fLastMLE;
158
159 // this will store a snapshot of the unconditional nuisance
160 // parameter fit.
164 RooArgSet fConditionalObs; // conditional observables
165 RooArgSet fGlobalObs; // global observables
166
168
176
177 protected:
178
179 ClassDef(ProfileLikelihoodTestStat,10) // implements the profile likelihood ratio as a test statistic to be used with several tools
180 };
181}
182
183
184#endif
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:43
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
static const std::string & DefaultMinimizerType()
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:44
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:60
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Definition: RooArgSet.h:88
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
virtual void SetConditionalObservables(const RooArgSet &set)
interface to set conditional observables. If a test statistics needs them it will re-implement this f...
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
virtual Double_t EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet &paramsOfInterest)
internal function to evaluate test statistics can do depending on type:
virtual void SetGlobalObservables(const RooArgSet &set)
interface to set global observables. If a test statistics needs them it will re-implement this functi...
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
virtual Double_t Evaluate(RooAbsData &data, RooArgSet &paramsOfInterest)
Main interface to evaluate the test statistic on a dataset given the values for the Null Parameters O...
virtual const TString GetVarName() const
virtual void SetVarName(const char *name)
RooFitResult * GetMinNLL()
find minimum of NLL using RooMinimizer
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:31
Basic string class.
Definition: TString.h:131
Namespace for the RooStats classes.
Definition: Asimov.h:19
bool IsNLLOffset()
Test of RooStats should by default offset NLL calculations.
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212