![]() |
aGrUM
0.16.0
|
Represent the chi2 distribution. More...
#include <agrum/core/math/chi2.h>
Public Member Functions | |
Constructors / Destructors | |
Chi2 (const std::vector< std::size_t > &var_modalities, double confidence_proba=GUM_LEARNING_CONFIDENCE_PROBA) | |
Default constructor. More... | |
~Chi2 () | |
Class destructor. More... | |
Accessors / Modifiers | |
void | setConditioningNodes (const std::vector< Idx > &db_conditioning_ids) |
Sets the conditioning nodes (useful for computing degrees of freedom). More... | |
double | criticalValue (const std::pair< Idx, Idx > &pair) |
Computes the critical value according to the number of degrees of freedom. More... | |
double | criticalValue (Idx var1, Idx var2) |
Computes the critical value according to the number of degrees of freedom. More... | |
Size | degreesOfFreedom (const std::pair< Idx, Idx > &pair) |
Returns the number of degrees of freedom. More... | |
Size | degreesOfFreedom (Idx var1, Idx var2) |
Returns the number of degrees of freedom. More... | |
void | setConfidenceProba (double new_proba) |
Modifies the confidence probability. More... | |
static double | probaChi2 (double x, Size df) |
Computes the probability of chi2 value. More... | |
Represent the chi2 distribution.
The class constructor receives a std::vector of unsigned integers. This std::vector represents the variables modalities. The variables indexes in the std::vector will be used as the variables identifiers.
gum::Chi2::Chi2 | ( | const std::vector< std::size_t > & | var_modalities, |
double | confidence_proba = GUM_LEARNING_CONFIDENCE_PROBA |
||
) |
Default constructor.
var_modalities | The variables modalities. |
confidence_proba | The confidence probability. |
Definition at line 58 of file chi2.cpp.
gum::Chi2::~Chi2 | ( | ) |
Class destructor.
Definition at line 67 of file chi2.cpp.
|
privatedelete |
Forbid use of the copy constructor.
Computes the critical value of a given chi2 test (used by the cache).
This code has been written by Gary Perlman.
proba | The probability value. |
df | The number of degrees of freedom. |
Definition at line 180 of file chi2.cpp.
References probaChi2().
Referenced by criticalValue().
Computes the probability of normal z value.
This code has been written by Gary Perlman.
ALGORITHM Adapted from a polynomial approximation in: Ibbetson D, Algorithm 209 Collected Algorithms of the CACM 1963 p. 616
This routine has six digit accuracy, so it is only useful for absolute z values < 6. For z values >= to 6.0, __probaZValue() returns 0.0.
z | A value. |
Definition at line 73 of file chi2.cpp.
Referenced by probaChi2().
Computes the critical value according to the number of degrees of freedom.
pair | A pair of variables ids. |
Definition at line 57 of file chi2_inl.h.
Computes the critical value according to the number of degrees of freedom.
var1 | The first variable id. |
var2 | The second variable id. |
Definition at line 62 of file chi2_inl.h.
References __confidence_proba, __critical_values, __criticalValue(), degreesOfFreedom(), and gum::HashTable< Key, Val, Alloc >::insert().
Returns the number of degrees of freedom.
pair | A pair of variables ids. |
Definition at line 46 of file chi2_inl.h.
Referenced by criticalValue().
Returns the number of degrees of freedom.
var1 | The first variable id. |
var2 | The second variable id. |
Definition at line 51 of file chi2_inl.h.
References __conditioning_size, and __modalities.
Computes the probability of chi2 value.
This code has been written by Gary Perlman.
ALGORITHM Compute probability of chi square value. Adapted from: Hill, I. D. and Pike, M. C. Algorithm 299 Collected Algorithms for the CACM 1967 p. 243 Updated for rounding errors based on remark in ACM TOMS June 1985, page 185
x | The chi2 value. |
df | The number of degrees of freedom. |
Definition at line 133 of file chi2.cpp.
References __probaZValue().
Referenced by __criticalValue().
INLINE void gum::Chi2::setConditioningNodes | ( | const std::vector< Idx > & | db_conditioning_ids | ) |
Sets the conditioning nodes (useful for computing degrees of freedom).
db_conditioning_ids | The conditioning nodes id. |
Definition at line 38 of file chi2_inl.h.
References __conditioning_size, and __modalities.
INLINE void gum::Chi2::setConfidenceProba | ( | double | new_proba | ) |
Modifies the confidence probability.
new_proba | The new confidence probability |
Definition at line 78 of file chi2_inl.h.
References __confidence_proba, __critical_values, and gum::HashTable< Key, Val, Alloc >::clear().
|
private |
The domain size of the conditioning nodes.
Definition at line 158 of file chi2.h.
Referenced by degreesOfFreedom(), and setConditioningNodes().
|
private |
The confidence probability used for critical values.
Definition at line 155 of file chi2.h.
Referenced by criticalValue(), and setConfidenceProba().
A set of already computed critical values.
Definition at line 161 of file chi2.h.
Referenced by criticalValue(), and setConfidenceProba().
|
private |
The modalities of the random variables.
Definition at line 152 of file chi2.h.
Referenced by degreesOfFreedom(), and setConditioningNodes().