Logo ROOT   6.08/07
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 #ifndef ROOT_Rtypes
17 #include "Rtypes.h"
18 #endif
19 
20 #ifndef ROOSTATS_TestStatistic
21 #include "RooStats/TestStatistic.h"
22 #endif
23 
24 
25 #ifndef ROO_REAL_VAR
26 #include "RooRealVar.h"
27 #endif
28 
29 #ifndef ROO_NLL_VAR
30 #include "RooNLLVar.h"
31 #endif
32 
33 #ifndef ROOTT_Math_MinimizerOptions
34 #include "Math/MinimizerOptions.h"
35 #endif
36 
37 #ifndef ROOSTATS_RooStatsUtils
38 #include "RooStats/RooStatsUtils.h"
39 #endif
40 
41 
42 namespace RooStats {
43 
44 /**
45 
46 
47 ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the profile likelihood ratio at a particular parameter point given a dataset. It does not constitute a statistical test, for that one may either use:
48 
49 * the ProfileLikelihoodCalculator that relies on asymptotic properties of the Profile Likelihood Ratio
50 * the Neyman Construction classes with this class as a test statistic
51 * the Hybrid Calculator class with this class as a test statistic
52 
53 \ingroup Roostats
54 
55 */
56 
58 
60 
61  public:
63  // Proof constructor. Do not use.
64  fPdf = 0;
65  fNll = 0;
67  fLastData = 0;
69  fSigned = false;
71  fDetailedOutputEnabled = false;
74 
75  fVarName = "Profile Likelihood Ratio";
76  fReuseNll = false;
81 
82  }
84  fPdf = &pdf;
85  fNll = 0;
87  fLastData = 0;
89  fSigned = false;
91  fDetailedOutputEnabled = false;
94 
95  fVarName = "Profile Likelihood Ratio";
96  fReuseNll = false;
99  // avoid default tolerance to be too small (1. is default in RooMinimizer)
102  }
103 
105  if(fNll) delete fNll;
107  if(fDetailedOutput) delete fDetailedOutput;
108  }
109 
110  //LM use default copy constructor and assignment copying the pointers. Is this what we want ?
111 
112  void SetOneSided(Bool_t flag=true) {fLimitType = (flag ? oneSided : twoSided);}
114  void SetSigned(Bool_t flag=true) {fSigned = flag;} // +/- t_mu instead of t_mu>0 with one-sided settings
115  //void SetOneSidedDiscovery(Bool_t flag=true) {fOneSidedDiscovery = flag;}
116 
117  bool IsTwoSided() const { return fLimitType == twoSided; }
119 
120  static void SetAlwaysReuseNLL(Bool_t flag);
121 
122  void SetReuseNLL(Bool_t flag) { fReuseNll = flag ; }
123  void SetLOffset(Bool_t flag=kTRUE) { fLOffset = flag ; }
124 
125  void SetMinimizer(const char* minimizer){ fMinimizer=minimizer;}
129 
130  // Main interface to evaluate the test statistic on a dataset
131  virtual Double_t Evaluate(RooAbsData& data, RooArgSet& paramsOfInterest) {
132  return EvaluateProfileLikelihood(0, data, paramsOfInterest);
133  }
134 
135  // evaluate the profile likelihood ratio (type = 0) or the minimum of likelihood (type=1) or the conditional LL (type = 2)
136  virtual Double_t EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet & paramsOfInterest);
137 
138  virtual void EnableDetailedOutput( bool e=true, bool withErrorsAndPulls=false ) {
140  fDetailedOutputWithErrorsAndPulls = withErrorsAndPulls;
141  delete fDetailedOutput;
143  }
144  virtual const RooArgSet* GetDetailedOutput(void) const {
145  // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
146  // The returned RooArgSet contains the following:
147  // <ul>
148  // <li> the minimum nll, fitstatus and convergence quality for each fit </li>
149  // <li> for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored </li>
150  // </ul>
151  return fDetailedOutput;
152  }
153 
154  // set the conditional observables which will be used when creating the NLL
155  // so the pdf's will not be normalized on the conditional observables when computing the NLL
157 
158  virtual void SetVarName(const char* name) { fVarName = name; }
159  virtual const TString GetVarName() const {return fVarName;}
160 
161  virtual RooAbsPdf * GetPdf() const { return fPdf; }
162 
163 
164  // const bool PValueIsRightTail(void) { return false; } // overwrites default
165 
166  private:
167 
169 
170  private:
171 
176  // Double_t fLastMLE;
179 
180  // this will store a snapshot of the unconditional nuisance
181  // parameter fit.
185  RooArgSet fConditionalObs; // conditional observables
186 
188 
196 
197  protected:
198 
199  ClassDef(ProfileLikelihoodTestStat,9) // implements the profile likelihood ratio as a test statistic to be used with several tools
200  };
201 }
202 
203 
204 #endif
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
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:86
Basic string class.
Definition: TString.h:137
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual const TString GetVarName() const
virtual Double_t EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet &paramsOfInterest)
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
int printlevel
const double tol
static const std::string & DefaultMinimizerType()
virtual void SetConditionalObservables(const RooArgSet &set)
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...
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
Namespace for the RooStats classes.
Definition: Asimov.h:20
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
int type
Definition: TGX11.cxx:120
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
bool IsNLLOffset()
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
#define NULL
Definition: Rtypes.h:82
const int strategy
Definition: testNdimFit.cxx:46
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetVarName(const char *name)
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:33
char name[80]
Definition: TGX11.cxx:109