Logo ROOT   6.10/09
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),
37  {
38  // Proof constructor. Don't use.
39  }
40 
42  const RooArgSet* altPOI=0) :
43  fNullProfile(nullPdf),
44  fAltProfile(altPdf),
45  fSubtractMLE(true),
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  }
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  virtual const RooArgSet* GetDetailedOutput(void) const {
112  // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
113  // The returned RooArgSet contains the following for the alternative and null hypotheses:
114  // - the minimum nll, fitstatus and convergence quality for each fit
115  // - for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored
116  return fDetailedOutput;
117  }
118 
119 
120 
121 
122  virtual const TString GetVarName() const { return "log(L(#mu_{1},#hat{#nu}_{1}) / L(#mu_{0},#hat{#nu}_{0}))"; }
123 
124  // const bool PValueIsRightTail(void) { return false; } // overwrites default
125 
126  void SetSubtractMLE(bool subtract){fSubtractMLE = subtract;}
127 
128  private:
129 
132 
136 
139 
140 
141  protected:
142  ClassDef(RatioOfProfiledLikelihoodsTestStat,3) // implements the ratio of profiled likelihood as test statistic
143 };
144 
145 }
146 
147 
148 #endif
Basic string class.
Definition: TString.h:129
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
#define NULL
Definition: RtypesCore.h:88
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
const double tol
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)
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
const int strategy
Definition: testNdimFit.cxx:46
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:31
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...