Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
18
20
21
22namespace RooStats {
23
25
26 public:
27
31 fAltPOI(nullptr),
32 fSubtractMLE(true),
34 fDetailedOutput(nullptr)
35 {
36 // Proof constructor. Don't use.
37 }
38
40 const RooArgSet* altPOI=nullptr) :
41 fNullProfile(nullPdf),
42 fAltProfile(altPdf),
43 fSubtractMLE(true),
45 fDetailedOutput(nullptr)
46 {
47 // Calculates the ratio of profiled likelihoods.
48
49 if(altPOI)
50 fAltPOI = (RooArgSet*) altPOI->snapshot();
51 else
52 fAltPOI = new RooArgSet(); // empty set
53
54 }
55
56 //__________________________________________
58 if(fAltPOI) delete fAltPOI;
60 }
61
62
63 /// returns -logL(poi, conditional MLE of nuisance params)
64 /// it does not subtract off the global MLE
65 /// because nuisance parameters of null and alternate may not
66 /// be the same.
68
69 /// evaluate the ratio of profile likelihood
70 double Evaluate(RooAbsData& data, RooArgSet& nullParamsOfInterest) override;
71
72 virtual void EnableDetailedOutput( bool e=true ) {
76 }
77
78 static void SetAlwaysReuseNLL(bool flag);
79
80 void SetReuseNLL(bool flag) {
83 }
84
85 void SetMinimizer(const char* minimizer){
86 fNullProfile.SetMinimizer(minimizer);
87 fAltProfile.SetMinimizer(minimizer);
88 }
89 void SetStrategy(Int_t strategy){
90 fNullProfile.SetStrategy(strategy);
91 fAltProfile.SetStrategy(strategy);
92 }
93 void SetTolerance(double tol){
96 }
97 void SetPrintLevel(Int_t printLevel){
98 fNullProfile.SetPrintLevel(printLevel);
99 fAltProfile.SetPrintLevel(printLevel);
100 }
101
102 /// set the conditional observables which will be used when creating the NLL
103 /// so the pdf's will not be normalized on the conditional observables when computing the NLL
104 void SetConditionalObservables(const RooArgSet& set) override {
107 }
108
109 /// set the global observables which will be used when creating the NLL
110 /// so the constraint pdf's will be normalized correctly on the global observables when computing the NLL
111 void SetGlobalObservables(const RooArgSet& set) override {
114 }
115
116 /// Returns detailed output. The value returned by this function is updated after each call to Evaluate().
117 /// The returned RooArgSet contains the following for the alternative and null hypotheses:
118 /// - the minimum nll, fitstatus and convergence quality for each fit
119 /// - for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored
120 const RooArgSet* GetDetailedOutput(void) const override {
121 return fDetailedOutput;
122 }
123
124
125
126
127 const TString GetVarName() const override { return "log(L(#mu_{1},#hat{#nu}_{1}) / L(#mu_{0},#hat{#nu}_{0}))"; }
128
129 // const bool PValueIsRightTail(void) { return false; } // overwrites default
130
131 void SetSubtractMLE(bool subtract){fSubtractMLE = subtract;}
132
133 private:
134
137
140 static bool fgAlwaysReuseNll ;
141
144
145
146 protected:
147 ClassDefOverride(RatioOfProfiledLikelihoodsTestStat,3) // implements the ratio of profiled likelihood as test statistic
148 };
149
150}
151
152
153#endif
#define e(i)
Definition RSha256.hxx:103
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition RooArgSet.h:178
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
void SetConditionalObservables(const RooArgSet &set) override
set the conditional observables which will be used when creating the NLL so the pdf's will not be nor...
void SetGlobalObservables(const RooArgSet &set) override
set the global observables which will be used when creating the NLL so the constraint pdf's will be n...
TestStatistic that returns the ratio of profiled likelihoods.
double Evaluate(RooAbsData &data, RooArgSet &nullParamsOfInterest) override
evaluate the ratio of profile likelihood
void SetGlobalObservables(const RooArgSet &set) override
set the global observables which will be used when creating the NLL so the constraint pdf's will be n...
void SetConditionalObservables(const RooArgSet &set) override
set the conditional observables which will be used when creating the NLL so the pdf's will not be nor...
RatioOfProfiledLikelihoodsTestStat(RooAbsPdf &nullPdf, RooAbsPdf &altPdf, const RooArgSet *altPOI=nullptr)
const RooArgSet * GetDetailedOutput(void) const override
Returns detailed output.
double ProfiledLikelihood(RooAbsData &data, RooArgSet &poi, RooAbsPdf &pdf)
returns -logL(poi, conditional MLE of nuisance params) it does not subtract off the global MLE becaus...
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Basic string class.
Definition TString.h:139
Namespace for the RooStats classes.
Definition Asimov.h:19