![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Represent the chi2 distribution. More...
#include <agrum/base/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. | |
| ~Chi2 () | |
| Class destructor. | |
Private Member Functions | |
| Chi2 (const Chi2 &)=delete | |
| Forbid use of the copy constructor. | |
| Chi2 & | operator= (const Chi2 &)=delete |
| Forbid used of the copy operator. | |
Static Private Member Functions | |
| static double | _criticalValue_ (double proba, Size df) |
| Computes the critical value of a given chi2 test (used by the cache). | |
| static double | _probaZValue_ (double z) |
| Computes the probability of normal z value. | |
Private Attributes | |
| const std::vector< std::size_t > & | _modalities_ |
| The modalities of the random variables. | |
| double | _confidence_proba_ |
| The confidence probability used for critical values. | |
| Size | _conditioning_size_ |
| The domain size of the conditioning nodes. | |
| HashTable< Idx, double > | _critical_values_ |
| A set of already computed critical values. | |
Accessors / Modifiers | |
| void | setConditioningNodes (const std::vector< Idx > &db_conditioning_ids) |
| Sets the conditioning nodes (useful for computing degrees of freedom). | |
| double | criticalValue (const std::pair< Idx, Idx > &pair) |
| Computes the critical value according to the number of degrees of freedom. | |
| double | criticalValue (Idx var1, Idx var2) |
| Computes the critical value according to the number of degrees of freedom. | |
| Size | degreesOfFreedom (const std::pair< Idx, Idx > &pair) |
| Returns the number of degrees of freedom. | |
| Size | degreesOfFreedom (Idx var1, Idx var2) |
| Returns the number of degrees of freedom. | |
| void | setConfidenceProba (double new_proba) |
| Modifies the confidence probability. | |
| static double | probaChi2 (double x, Size df) |
| Computes the probability of chi2 value. | |
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 76 of file chi2.cpp.
References Chi2(), _confidence_proba_, and _modalities_.
Referenced by Chi2(), Chi2(), ~Chi2(), and operator=().
| gum::Chi2::~Chi2 | ( | ) |
|
privatedelete |
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 190 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 89 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 74 of file chi2_inl.h.
References criticalValue().
Referenced by criticalValue().
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 79 of file chi2_inl.h.
References _confidence_proba_, _critical_values_, _criticalValue_(), and degreesOfFreedom().
Returns the number of degrees of freedom.
| pair | A pair of variables ids. |
Definition at line 64 of file chi2_inl.h.
References degreesOfFreedom().
Referenced by criticalValue(), and degreesOfFreedom().
Returns the number of degrees of freedom.
| var1 | The first variable id. |
| var2 | The second variable id. |
Definition at line 69 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 144 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 56 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 95 of file chi2_inl.h.
References _confidence_proba_, and _critical_values_.
|
private |
The domain size of the conditioning nodes.
Definition at line 179 of file chi2.h.
Referenced by degreesOfFreedom(), and setConditioningNodes().
|
private |
The confidence probability used for critical values.
Definition at line 176 of file chi2.h.
Referenced by Chi2(), criticalValue(), and setConfidenceProba().
A set of already computed critical values.
Definition at line 182 of file chi2.h.
Referenced by criticalValue(), and setConfidenceProba().
|
private |
The modalities of the random variables.
Definition at line 173 of file chi2.h.
Referenced by Chi2(), degreesOfFreedom(), and setConditioningNodes().