1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef ChiSquared_H
#define ChiSquared_H
/** \class ChiSquared
* Constructed with total chi-squared value `value` and number of degrees
* of freedom `ndf`. <BR>
*
* Computes chi-squared upper tail probability,
* i.e. the probability that an observation, correctly described by
* a model with nrDOF, will give rise to a chi-squared larger than the one
* observed. From this, one can interpret this probability as how likely
* it is to observe as high (or higher) a chi-squared. <BR>
*
* Also computes the natural logarithm of that probability,
* useful to compare very unlikely events, for which the probability
* is rounded off to 0.
*/
class ChiSquared {
public:
ChiSquared(float value, float ndf) : theValue(value), theNDF(ndf) {}
float value() const;
float degreesOfFreedom() const;
float probability() const;
float lnProbability() const;
private:
float theValue, theNDF;
};
#endif
|