Hypothesis Test Calculator based on the asymptotic formulae for the profile likelihood ratio.
It performs hypothesis tests using the asymptotic formula for the profile likelihood, and uses the Asimov data set to compute expected significances or limits.
See G. Cowan, K. Cranmer, E. Gross and O. Vitells: Asymptotic formulae for likelihood- based tests of new physics. Eur. Phys. J., C71:1–19, 2011. It provides methods to perform hypothesis tests using the likelihood function, and computes the \(p\)-values for the null and the alternate hypothesis using the asymptotic formulae for the profile likelihood ratio described in the given paper.
The calculator provides methods to produce the Asimov dataset, i.e. a dataset generated where the observed values are equal to the expected ones. The Asimov data set is then used to compute the observed asymptotic \(p\)-value for the alternate hypothesis and the asymptotic expected \(p\)-values.
The asymptotic formulae are valid only for one POI (parameter of interest). So the calculator works only for one-dimensional (one POI) models. If more than one POI exists, only the first one is used.
The calculator can generate Asimov datasets from two kinds of PDFs:
Definition at line 27 of file AsymptoticCalculator.h.
Public Member Functions | |
AsymptoticCalculator (RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, bool nominalAsimov=false) | |
constructor for asymptotic calculator from Data set and ModelConfig | |
~AsymptoticCalculator () | |
const RooArgSet & | GetBestFitParams () const |
return best fit value for all parameters | |
const RooArgSet & | GetBestFitPoi () const |
return snapshot of the best fit parameter | |
virtual HypoTestResult * | GetHypoTest () const |
re-implement HypoTest computation using the asymptotic | |
const RooRealVar * | GetMuHat () const |
return best fit parameter (firs of poi) | |
bool | Initialize () const |
initialize the calculator by performing a global fit and make the Asimov data set | |
bool | IsOneSidedDiscovery () const |
bool | IsTwoSided () const |
virtual void | SetAlternateModel (const ModelConfig &altModel) |
Set the model for the alternate hypothesis (S+B) | |
virtual void | SetData (RooAbsData &data) |
Set the DataSet. | |
virtual void | SetNullModel (const ModelConfig &nullModel) |
re-implementation of setters since they are needed to re-initialize the calculator | |
void | SetOneSided (bool on) |
set test statistic for one sided (upper limits) | |
void | SetOneSidedDiscovery (bool on) |
set the test statistics for one-sided discovery | |
void | SetQTilde (bool on) |
set using of qtilde, by default is controlled if RoORealVar is limited or not | |
void | SetTwoSided () |
set the test statistics for two sided (in case of upper limits for discovery does not make really sense) | |
Public Member Functions inherited from RooStats::HypoTestCalculatorGeneric | |
HypoTestCalculatorGeneric (const RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, TestStatSampler *sampler=0) | |
Constructor. | |
~HypoTestCalculatorGeneric () | |
const ModelConfig * | GetAlternateModel (void) const |
const RooAbsData * | GetData (void) const |
virtual const RooArgSet * | GetFitInfo () const |
const ModelConfig * | GetNullModel (void) const |
TestStatSampler * | GetTestStatSampler (void) const |
Returns instance of TestStatSampler. | |
void | UseSameAltToys () |
Set this for re-using always the same toys for alternate hypothesis in case of calls at different null parameter points This is useful to get more stable bands when running the HypoTest inversion. | |
Public Member Functions inherited from RooStats::HypoTestCalculator | |
virtual | ~HypoTestCalculator () |
virtual void | SetCommonModel (const ModelConfig &model) |
Static Public Member Functions | |
static RooAbsData * | GenerateAsimovData (const RooAbsPdf &pdf, const RooArgSet &observables) |
generate the asimov data for the observables (not the global ones) need to deal with the case of a sim pdf | |
static double | GetExpectedPValues (double pnull, double palt, double nsigma, bool usecls, bool oneSided=true) |
function given the null and the alt p value - return the expected one given the N - sigma value | |
static RooAbsData * | MakeAsimovData (const ModelConfig &model, const RooArgSet &allParamValues, RooArgSet &globObs) |
Make a nominal Asimov data set from a model. | |
static RooAbsData * | MakeAsimovData (RooAbsData &data, const ModelConfig &model, const RooArgSet &poiValues, RooArgSet &globObs, const RooArgSet *genPoiValues=0) |
Make Asimov data. | |
static void | SetPrintLevel (int level) |
set print level (static function) | |
Static Protected Member Functions | |
static double | EvaluateNLL (RooAbsPdf &pdf, RooAbsData &data, const RooArgSet *condObs, const RooArgSet *globObs, const RooArgSet *poiSet=0) |
static void | FillBins (const RooAbsPdf &pdf, const RooArgList &obs, RooAbsData &data, int &index, double &binVolume, int &ibin) |
fill bins by looping recursively on observables | |
static RooAbsData * | GenerateAsimovDataSinglePdf (const RooAbsPdf &pdf, const RooArgSet &obs, const RooRealVar &weightVar, RooCategory *channelCat=0) |
Compute the asimov data set for an observable of a pdf. | |
static RooAbsData * | GenerateCountingAsimovData (RooAbsPdf &pdf, const RooArgSet &obs, const RooRealVar &weightVar, RooCategory *channelCat=0) |
Generate counting Asimov data for the case when the pdf cannot be extended. | |
static bool | SetObsToExpected (RooAbsPdf &pdf, const RooArgSet &obs) |
set observed value to the expected one works for Gaussian, Poisson or LogNormal assumes mean parameter value is the argument not constant and not depending on observables (if more than two arguments are not constant will use first one but print a warning !) need to iterate on the components of the Poisson to get n and nu (nu can be a RooAbsReal) (code from G. | |
static bool | SetObsToExpected (RooProdPdf &prod, const RooArgSet &obs) |
Inpspect a product pdf to find all the Poisson or Gaussian parts to set the observed values to expected ones. | |
Private Attributes | |
RooAbsData * | fAsimovData |
RooArgSet | fAsimovGlobObs |
RooArgSet | fBestFitParams |
RooArgSet | fBestFitPoi |
bool | fIsInitialized |
double | fNLLAsimov |
double | fNLLObs |
bool | fNominalAsimov |
bool | fOneSided |
bool | fOneSidedDiscovery |
int | fUseQTilde |
flag to check if calculator is initialized | |
Static Private Attributes | |
static int | fgPrintLevel = 1 |
Additional Inherited Members | |
Protected Member Functions inherited from RooStats::HypoTestCalculatorGeneric | |
virtual int | CheckHook (void) const |
virtual void | PostHook () const |
virtual int | PreAltHook (RooArgSet *, double) const |
virtual void | PreHook () const |
virtual int | PreNullHook (RooArgSet *, double) const |
Protected Attributes inherited from RooStats::HypoTestCalculatorGeneric | |
const ModelConfig * | fAltModel |
unsigned int | fAltToysSeed |
const RooAbsData * | fData |
TestStatSampler * | fDefaultSampler |
TestStatistic * | fDefaultTestStat |
const ModelConfig * | fNullModel |
TestStatSampler * | fTestStatSampler |
#include <RooStats/AsymptoticCalculator.h>
AsymptoticCalculator::AsymptoticCalculator | ( | RooAbsData & | data, |
const ModelConfig & | altModel, | ||
const ModelConfig & | nullModel, | ||
bool | nominalAsimov = false |
||
) |
constructor for asymptotic calculator from Data set and ModelConfig
Definition at line 94 of file AsymptoticCalculator.cxx.
|
inline |
Definition at line 40 of file AsymptoticCalculator.h.
|
staticprotected |
Definition at line 291 of file AsymptoticCalculator.cxx.
|
staticprotected |
fill bins by looping recursively on observables
Definition at line 857 of file AsymptoticCalculator.cxx.
|
static |
generate the asimov data for the observables (not the global ones) need to deal with the case of a sim pdf
Definition at line 1140 of file AsymptoticCalculator.cxx.
|
staticprotected |
Compute the asimov data set for an observable of a pdf.
It generates binned data following the binning of the observables.
Definition at line 1061 of file AsymptoticCalculator.cxx.
|
staticprotected |
Generate counting Asimov data for the case when the pdf cannot be extended.
This function assumes that the pdf is a RooPoisson or can be decomposed in a product of RooPoisson, or is a RooGaussian. Otherwise, we cannot know how to make the Asimov data sets.
Definition at line 1022 of file AsymptoticCalculator.cxx.
|
inline |
return best fit value for all parameters
Definition at line 100 of file AsymptoticCalculator.h.
|
inline |
return snapshot of the best fit parameter
Definition at line 96 of file AsymptoticCalculator.h.
|
static |
function given the null and the alt p value - return the expected one given the N - sigma value
Definition at line 808 of file AsymptoticCalculator.cxx.
|
virtual |
re-implement HypoTest computation using the asymptotic
It performs an hypothesis tests using the likelihood function and computes the p values for the null and the alternate using the asymptotic formulae for the profile likelihood ratio.
See G. Cowan, K. Cranmer, E. Gross and O. Vitells. Asymptotic formulae for likelihood- based tests of new physics. Eur. Phys. J., C71:1–19, 2011. The formulae are valid only for one POI. If more than one POI exists consider as POI only the first one
Reimplemented from RooStats::HypoTestCalculatorGeneric.
Definition at line 476 of file AsymptoticCalculator.cxx.
|
inline |
return best fit parameter (firs of poi)
Definition at line 98 of file AsymptoticCalculator.h.
bool AsymptoticCalculator::Initialize | ( | ) | const |
initialize the calculator by performing a global fit and make the Asimov data set
Initialize the calculator The initialization will perform a global fit of the model to the data and build an Asimov data set.
It will then also fit the model to the Asimov data set to find the likelihood value of the Asimov data set nominalAsimov is an option for using Asimov data set obtained using nominal nuisance parameter values By default the nuisance parameters are fitted to the data NOTE: If a fit has been done before, one for speeding up could set all the initial parameters to the fit value and in addition set the null snapshot to the best fit
Definition at line 132 of file AsymptoticCalculator.cxx.
|
inline |
Definition at line 89 of file AsymptoticCalculator.h.
|
inline |
Definition at line 88 of file AsymptoticCalculator.h.
|
static |
Make a nominal Asimov data set from a model.
model | ModelConfig that contains the model pdf and the model parameters | |
allParamValues | The parameters fo the model will be set to the values given in this set | |
[out] | asimovGlobObs | Global observables set to values satisfying the constraints |
The parameter values (including the nuisance parameter) can result from a fit to data or be at the nominal values.
Definition at line 1347 of file AsymptoticCalculator.cxx.
|
static |
Make Asimov data.
Make the Asimov data from the ModelConfig and list of poi.
realData | Real data | |
model | Model config defining the pdf and the parameters | |
paramValues | The snapshot of POI and parameters used for finding the best nuisance parameter values (conditioned at these values) | |
[out] | asimovGlobObs | Global observables set to values satisfying the constraints |
genPoiValues | Optional. A different set of POI values used for generating. By default the same POI are used for generating and for finding the nuisance parameters given an observed data set, a model and a snapshot of the poi. |
Definition at line 1224 of file AsymptoticCalculator.cxx.
|
inlinevirtual |
Set the model for the alternate hypothesis (S+B)
Reimplemented from RooStats::HypoTestCalculatorGeneric.
Definition at line 78 of file AsymptoticCalculator.h.
|
inlinevirtual |
Set the DataSet.
Reimplemented from RooStats::HypoTestCalculatorGeneric.
Definition at line 82 of file AsymptoticCalculator.h.
|
inlinevirtual |
re-implementation of setters since they are needed to re-initialize the calculator
Reimplemented from RooStats::HypoTestCalculatorGeneric.
Definition at line 74 of file AsymptoticCalculator.h.
|
staticprotected |
set observed value to the expected one works for Gaussian, Poisson or LogNormal assumes mean parameter value is the argument not constant and not depending on observables (if more than two arguments are not constant will use first one but print a warning !) need to iterate on the components of the Poisson to get n and nu (nu can be a RooAbsReal) (code from G.
Petrucciani and extended by L.M.)
Definition at line 968 of file AsymptoticCalculator.cxx.
|
staticprotected |
Inpspect a product pdf to find all the Poisson or Gaussian parts to set the observed values to expected ones.
Definition at line 929 of file AsymptoticCalculator.cxx.
set test statistic for one sided (upper limits)
Definition at line 64 of file AsymptoticCalculator.h.
set the test statistics for one-sided discovery
Definition at line 71 of file AsymptoticCalculator.h.
set print level (static function)
Definition at line 87 of file AsymptoticCalculator.cxx.
set using of qtilde, by default is controlled if RoORealVar is limited or not
Definition at line 93 of file AsymptoticCalculator.h.
|
inline |
set the test statistics for two sided (in case of upper limits for discovery does not make really sense)
Definition at line 68 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 141 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 142 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 144 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 143 of file AsymptoticCalculator.h.
|
staticprivate |
Definition at line 137 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 135 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 139 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 138 of file AsymptoticCalculator.h.
|
private |
Definition at line 134 of file AsymptoticCalculator.h.
|
private |
Definition at line 132 of file AsymptoticCalculator.h.
|
mutableprivate |
Definition at line 133 of file AsymptoticCalculator.h.
|
mutableprivate |
flag to check if calculator is initialized
Definition at line 136 of file AsymptoticCalculator.h.