57 Bool_t RooStats::RatioOfProfiledLikelihoodsTestStat::fgAlwaysReuseNll = kTRUE ;
59 void RooStats::RatioOfProfiledLikelihoodsTestStat::SetAlwaysReuseNLL(Bool_t flag) { fgAlwaysReuseNll = flag ; }
68 Double_t RooStats::RatioOfProfiledLikelihoodsTestStat::ProfiledLikelihood(RooAbsData& data, RooArgSet& poi, RooAbsPdf& pdf) {
69 int type = (fSubtractMLE) ? 0 : 2;
72 if ( &pdf == fNullProfile.GetPdf() )
73 return fNullProfile.EvaluateProfileLikelihood(type, data, poi);
74 else if (&pdf == fAltProfile.GetPdf() )
75 return fAltProfile.EvaluateProfileLikelihood(type, data, poi);
77 oocoutE((TObject*)NULL,InputArguments) <<
"RatioOfProfiledLikelihoods::ProfileLikelihood - invalid pdf used for computing the profiled likelihood - return NaN"
80 return TMath::QuietNaN();
87 Double_t RooStats::RatioOfProfiledLikelihoodsTestStat::Evaluate(RooAbsData& data, RooArgSet& nullParamsOfInterest) {
89 int type = (fSubtractMLE) ? 0 : 2;
92 double nullNLL = fNullProfile.EvaluateProfileLikelihood(type, data, nullParamsOfInterest);
93 const RooArgSet *nullset = fNullProfile.GetDetailedOutput();
96 double altNLL = fAltProfile.EvaluateProfileLikelihood(type, data, *fAltPOI);
97 const RooArgSet *altset = fAltProfile.GetDetailedOutput();
99 if (fDetailedOutput != NULL) {
100 delete fDetailedOutput;
101 fDetailedOutput = NULL;
103 if (fDetailedOutputEnabled) {
104 fDetailedOutput =
new RooArgSet();
106 for(TIterator *it = nullset->createIterator();(var =
dynamic_cast<RooRealVar*
>(it->Next()));) {
107 RooRealVar* cloneVar =
new RooRealVar(TString::Format(
"nullprof_%s", var->GetName()),
108 TString::Format(
"%s for null", var->GetTitle()), var->getVal());
109 fDetailedOutput->addOwned(*cloneVar);
111 for(TIterator *it = altset->createIterator();(var =
dynamic_cast<RooRealVar*
>(it->Next()));) {
112 RooRealVar* cloneVar =
new RooRealVar(TString::Format(
"altprof_%s", var->GetName()),
113 TString::Format(
"%s for null", var->GetTitle()), var->getVal());
114 fDetailedOutput->addOwned(*cloneVar);
126 return nullNLL -altNLL;