Logo ROOT   6.08/07
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 #ifndef ROOT_Rtypes
16 #include "Rtypes.h"
17 #endif
18 
19 #ifndef ROO_NLL_VAR
20 #include "RooNLLVar.h"
21 #endif
22 
23 #ifndef ROOSTATS_TestStatistic
24 #include "RooStats/TestStatistic.h"
25 #endif
26 
27 #ifndef ROOSTATS_ProfileLikelihoodTestStat
29 #endif
30 
31 
32 
33 
34 namespace RooStats {
35 
36  /**
37 
38 TestStatistic that returns the ratio of profiled likelihoods.
39 
40 By default the calculation is:
41 
42 \f[
43  \log{ \frac{ \lambda(\mu_{alt} , {conditional \: MLE \: for \: alt \: nuisance}) }
44  { \lambda(\mu_{null} , {conditional \: MLE \: for \: null \: nuisance}) } }
45 \f]
46 
47 where \f$ \lambda \f$ is the profile likelihood ratio, so the
48 MLE for the null and alternate are subtracted off.
49 
50 If ``SetSubtractMLE(false)`` then it calculates:
51 
52 \f[
53  \log{ \frac{ L(\mu_{alt} , {conditional \: MLE \: for \: alt \: nuisance}) }
54  { L(\mu_{null} , {conditional \: MLE \: for \: null \: nuisance}) } }
55 \f]
56 
57 where \f$ L \f$ is the Likelihood function.
58 
59 The values of the parameters of interest for the alternative
60 hypothesis are taken at the time of the construction.
61 If empty, it treats all free parameters as nuisance parameters.
62 
63 The value of the parameters of interest for the null hypotheses
64 are given at each call of Evaluate.
65 
66 This test statistic is often called the Tevatron test statistic, because it has been used by the Tevatron experiments.
67 
68  \ingroup Roostats
69 
70 */
71 
72 
74 
75  public:
76 
78  fNullProfile(),
79  fAltProfile(),
80  fAltPOI(NULL),
81  fSubtractMLE(true),
84  {
85  // Proof constructor. Don't use.
86  }
87 
89  const RooArgSet* altPOI=0) :
90  fNullProfile(nullPdf),
91  fAltProfile(altPdf),
92  fSubtractMLE(true),
95  {
96  // Calculates the ratio of profiled likelihoods.
97 
98  if(altPOI)
99  fAltPOI = (RooArgSet*) altPOI->snapshot();
100  else
101  fAltPOI = new RooArgSet(); // empty set
102 
103  }
104 
105  //__________________________________________
107  if(fAltPOI) delete fAltPOI;
108  if(fDetailedOutput) delete fDetailedOutput;
109  }
110 
111 
112  // returns -logL(poi, conditional MLE of nuisance params)
113  // it does not subtract off the global MLE
114  // because nuisance parameters of null and alternate may not
115  // be the same.
117 
118  // evaluate the ratio of profile likelihood
119  virtual Double_t Evaluate(RooAbsData& data, RooArgSet& nullParamsOfInterest);
120 
121  virtual void EnableDetailedOutput( bool e=true ) {
125  }
126 
127  static void SetAlwaysReuseNLL(Bool_t flag);
128 
129  void SetReuseNLL(Bool_t flag) {
131  fAltProfile.SetReuseNLL(flag);
132  }
133 
134  void SetMinimizer(const char* minimizer){
135  fNullProfile.SetMinimizer(minimizer);
136  fAltProfile.SetMinimizer(minimizer);
137  }
139  fNullProfile.SetStrategy(strategy);
140  fAltProfile.SetStrategy(strategy);
141  }
145  }
146  void SetPrintLevel(Int_t printLevel){
147  fNullProfile.SetPrintLevel(printLevel);
148  fAltProfile.SetPrintLevel(printLevel);
149  }
150 
151  // set the conditional observables which will be used when creating the NLL
152  // so the pdf's will not be normalized on the conditional observables when computing the NLL
153  virtual void SetConditionalObservables(const RooArgSet& set) {
156  }
157 
158  virtual const RooArgSet* GetDetailedOutput(void) const {
159  // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
160  // The returned RooArgSet contains the following for the alternative and null hypotheses:
161  // <ul>
162  // <li> the minimum nll, fitstatus and convergence quality for each fit </li>
163  // <li> for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored </li>
164  // </ul>
165  return fDetailedOutput;
166  }
167 
168 
169 
170 
171  virtual const TString GetVarName() const { return "log(L(#mu_{1},#hat{#nu}_{1}) / L(#mu_{0},#hat{#nu}_{0}))"; }
172 
173  // const bool PValueIsRightTail(void) { return false; } // overwrites default
174 
175  void SetSubtractMLE(bool subtract){fSubtractMLE = subtract;}
176 
177  private:
178 
181 
185 
188 
189 
190  protected:
191  ClassDef(RatioOfProfiledLikelihoodsTestStat,3) // implements the ratio of profiled likelihood as test statistic
192 };
193 
194 }
195 
196 
197 #endif
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
#define ClassDef(name, id)
Definition: Rtypes.h:254
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
#define NULL
Definition: Rtypes.h:82
const int strategy
Definition: testNdimFit.cxx:46
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:33
Double_t ProfiledLikelihood(RooAbsData &data, RooArgSet &poi, RooAbsPdf &pdf)
returns -logL(poi, conditonal MLE of nuisance params) subtract off the global MLE or not depending on...