Logo ROOT   6.14/05
Reference Guide
RatioOfProfiledLikelihoodsTestStat.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Authors: Kyle Cranmer, Sven Kreiss June 2010
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_RatioOfProfiledLikelihoodsTestStat
12 #define ROOSTATS_RatioOfProfiledLikelihoodsTestStat
13 
14 
15 #include "Rtypes.h"
16 
17 #include "RooNLLVar.h"
18 
19 #include "RooStats/TestStatistic.h"
20 
22 
23 
24 namespace RooStats {
25 
27 
28  public:
29 
31  fNullProfile(),
32  fAltProfile(),
33  fAltPOI(NULL),
34  fSubtractMLE(true),
36  fDetailedOutput(NULL)
37  {
38  // Proof constructor. Don't use.
39  }
40 
42  const RooArgSet* altPOI=0) :
43  fNullProfile(nullPdf),
44  fAltProfile(altPdf),
45  fSubtractMLE(true),
47  fDetailedOutput(NULL)
48  {
49  // Calculates the ratio of profiled likelihoods.
50 
51  if(altPOI)
52  fAltPOI = (RooArgSet*) altPOI->snapshot();
53  else
54  fAltPOI = new RooArgSet(); // empty set
55 
56  }
57 
58  //__________________________________________
60  if(fAltPOI) delete fAltPOI;
62  }
63 
64 
65  // returns -logL(poi, conditional MLE of nuisance params)
66  // it does not subtract off the global MLE
67  // because nuisance parameters of null and alternate may not
68  // be the same.
70 
71  // evaluate the ratio of profile likelihood
72  virtual Double_t Evaluate(RooAbsData& data, RooArgSet& nullParamsOfInterest);
73 
74  virtual void EnableDetailedOutput( bool e=true ) {
78  }
79 
80  static void SetAlwaysReuseNLL(Bool_t flag);
81 
82  void SetReuseNLL(Bool_t flag) {
85  }
86 
87  void SetMinimizer(const char* minimizer){
88  fNullProfile.SetMinimizer(minimizer);
89  fAltProfile.SetMinimizer(minimizer);
90  }
91  void SetStrategy(Int_t strategy){
92  fNullProfile.SetStrategy(strategy);
93  fAltProfile.SetStrategy(strategy);
94  }
98  }
99  void SetPrintLevel(Int_t printLevel){
100  fNullProfile.SetPrintLevel(printLevel);
101  fAltProfile.SetPrintLevel(printLevel);
102  }
103 
104  // set the conditional observables which will be used when creating the NLL
105  // so the pdf's will not be normalized on the conditional observables when computing the NLL
106  virtual void SetConditionalObservables(const RooArgSet& set) {
109  }
110 
111  // set the global observables which will be used when creating the NLL
112  // so the constraint pdf's will be normalized correctly on the global observables when computing the NLL
113  virtual void SetGlobalObservables(const RooArgSet& set) {
116  }
117 
118  virtual const RooArgSet* GetDetailedOutput(void) const {
119  // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
120  // The returned RooArgSet contains the following for the alternative and null hypotheses:
121  // - the minimum nll, fitstatus and convergence quality for each fit
122  // - for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored
123  return fDetailedOutput;
124  }
125 
126 
127 
128 
129  virtual const TString GetVarName() const { return "log(L(#mu_{1},#hat{#nu}_{1}) / L(#mu_{0},#hat{#nu}_{0}))"; }
130 
131  // const bool PValueIsRightTail(void) { return false; } // overwrites default
132 
133  void SetSubtractMLE(bool subtract){fSubtractMLE = subtract;}
134 
135  private:
136 
139 
143 
146 
147 
148  protected:
149  ClassDef(RatioOfProfiledLikelihoodsTestStat,3) // implements the ratio of profiled likelihood as test statistic
150  };
151 
152 }
153 
154 
155 #endif
Basic string class.
Definition: TString.h:131
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:320
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 void SetGlobalObservables(const RooArgSet &set)
interface to set global observables. If a test statistics needs them it will re-implement this functi...
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
virtual void SetConditionalObservables(const RooArgSet &set)
interface to set conditional observables. If a test statistics needs them it will re-implement this f...
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...
TestStatistic that returns the ratio of profiled likelihoods.
Namespace for the RooStats classes.
Definition: Asimov.h:20
double Double_t
Definition: RtypesCore.h:55
virtual Double_t Evaluate(RooAbsData &data, RooArgSet &nullParamsOfInterest)
evaluate the ratio of profile likelihood
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
RatioOfProfiledLikelihoodsTestStat(RooAbsPdf &nullPdf, RooAbsPdf &altPdf, const RooArgSet *altPOI=0)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:31
virtual void SetConditionalObservables(const RooArgSet &set)
interface to set conditional observables. If a test statistics needs them it will re-implement this f...
Double_t ProfiledLikelihood(RooAbsData &data, RooArgSet &poi, RooAbsPdf &pdf)
returns -logL(poi, conditional MLE of nuisance params) subtract off the global MLE or not depending o...