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:
28 :
29
30 fAltPOI(nullptr),
31 fSubtractMLE(true),
33 fDetailedOutput(nullptr)
34 {
35 // Proof constructor. Don't use.
36 }
37
39 const RooArgSet* altPOI=nullptr) :
40 fNullProfile(nullPdf),
41 fAltProfile(altPdf),
42 fSubtractMLE(true),
44 fDetailedOutput(nullptr)
45 {
46 // Calculates the ratio of profiled likelihoods.
47
48 if (altPOI) {
49 fAltPOI = (RooArgSet*) altPOI->snapshot();
50 } else {
51 fAltPOI = new RooArgSet(); // empty set
52 }
53 }
54
55 //__________________________________________
57 if(fAltPOI) delete fAltPOI;
59 }
60
61
62 /// returns -logL(poi, conditional MLE of nuisance params)
63 /// it does not subtract off the global MLE
64 /// because nuisance parameters of null and alternate may not
65 /// be the same.
67
68 /// evaluate the ratio of profile likelihood
69 double Evaluate(RooAbsData& data, RooArgSet& nullParamsOfInterest) override;
70
71 virtual void EnableDetailedOutput( bool e=true ) {
75 }
76
77 static void SetAlwaysReuseNLL(bool flag);
78
79 void SetReuseNLL(bool flag) {
82 }
83
84 void SetMinimizer(const char* minimizer){
85 fNullProfile.SetMinimizer(minimizer);
86 fAltProfile.SetMinimizer(minimizer);
87 }
88 void SetStrategy(Int_t strategy){
89 fNullProfile.SetStrategy(strategy);
90 fAltProfile.SetStrategy(strategy);
91 }
92 void SetTolerance(double tol){
95 }
96 void SetPrintLevel(Int_t printLevel){
97 fNullProfile.SetPrintLevel(printLevel);
98 fAltProfile.SetPrintLevel(printLevel);
99 }
100
101 /// set the conditional observables which will be used when creating the NLL
102 /// so the pdf's will not be normalized on the conditional observables when computing the NLL
103 void SetConditionalObservables(const RooArgSet& set) override {
106 }
107
108 /// set the global observables which will be used when creating the NLL
109 /// so the constraint pdf's will be normalized correctly on the global observables when computing the NLL
110 void SetGlobalObservables(const RooArgSet& set) override {
113 }
114
115 /// Returns detailed output. The value returned by this function is updated after each call to Evaluate().
116 /// The returned RooArgSet contains the following for the alternative and null hypotheses:
117 /// - the minimum nll, fitstatus and convergence quality for each fit
118 /// - for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored
119 const RooArgSet* GetDetailedOutput(void) const override {
120 return fDetailedOutput;
121 }
122
123
124
125
126 const TString GetVarName() const override { return "log(L(#mu_{1},#hat{#nu}_{1}) / L(#mu_{0},#hat{#nu}_{0}))"; }
127
128 // const bool PValueIsRightTail(void) { return false; } // overwrites default
129
130 void SetSubtractMLE(bool subtract){fSubtractMLE = subtract;}
131
132 private:
133
136
139 static bool fgAlwaysReuseNll ;
140
143
144
145 protected:
146 ClassDefOverride(RatioOfProfiledLikelihoodsTestStat,3) // implements the ratio of profiled likelihood as test statistic
147 };
148
149}
150
151
152#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
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
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:191
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