Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:06

0001 #ifndef ChiSquaredProbability_H
0002 #define ChiSquaredProbability_H
0003 
0004 #include "CommonTools/Statistics/src/IncompleteGammaComplement.h"
0005 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
0006 
0007 /** Returns the probability that an observation, correctly described by
0008  *  a model with nrDOF, will give rise to a chi-squared larger than the one
0009  *  observed; from this, one can interpret this probability as how likely
0010  *  it is to observe as high (or higher) a chi-squared. 
0011  *  source: Numerical Recipes
0012  */
0013 float ChiSquaredProbability(double chiSquared, double nrDOF) {
0014   return IncompleteGammaComplement::value(nrDOF / 2, chiSquared / 2);
0015 }
0016 
0017 float LnChiSquaredProbability(double chiSquared, double nrDOF) {
0018   return IncompleteGammaComplement::ln(nrDOF / 2, chiSquared / 2);
0019 }
0020 
0021 #endif