Hypothesis test base class. Provides an interface for statistical hypothesis testing via three methods: compute_statistic(), compute_p_value() and compute_threshold(). The second computes a p-value for the statistic computed by the first method. The p-value represents the position of the statistic in the null-distribution, i.e. the distribution of the statistic population given the null-hypothesis is true. (1-position = p-value). The third method, compute_threshold(), computes a threshold for a given test level which is needed to reject the null-hypothesis.
Also provides an interface for sampling from the null-distribution. The actual sampling has to be implemented in sub-classes.
All statistical tests should inherit from this class.
Abstract base class.
Definition at line 78 of file HypothesisTest.h.
Public Member Functions
| ||CHypothesisTest ()|
|virtual ||~CHypothesisTest ()|
|virtual float64_t ||compute_statistic ()=0|
|virtual float64_t ||compute_p_value (float64_t statistic)|
|virtual float64_t ||compute_threshold (float64_t alpha)|
|virtual float64_t ||perform_test ()|
|bool ||perform_test (float64_t alpha)|
|virtual SGVector< float64_t > ||sample_null ()=0|
|virtual void ||set_num_null_samples (index_t num_null_samples)|
|virtual void ||set_null_approximation_method (ENullApproximationMethod null_approximation_method)|
|virtual EStatisticType ||get_statistic_type () const =0|
|virtual const char * ||get_name () const =0|
|virtual CSGObject * ||shallow_copy () const |
|virtual CSGObject * ||deep_copy () const |
|virtual bool ||is_generic (EPrimitiveType *generic) const |
|template<class T > |
|void ||set_generic ()|
|void ||unset_generic ()|
|virtual void ||print_serializable (const char *prefix="")|
|virtual bool ||save_serializable (CSerializableFile *file, const char *prefix="", int32_t param_version=Version::get_version_parameter())|
|virtual bool ||load_serializable (CSerializableFile *file, const char *prefix="", int32_t param_version=Version::get_version_parameter())|
|DynArray< TParameter * > * ||load_file_parameters (const SGParamInfo *param_info, int32_t file_version, CSerializableFile *file, const char *prefix="")|
|DynArray< TParameter * > * ||load_all_file_parameters (int32_t file_version, int32_t current_version, CSerializableFile *file, const char *prefix="")|
|void ||map_parameters (DynArray< TParameter * > *param_base, int32_t &base_version, DynArray< const SGParamInfo * > *target_param_infos)|
|void ||set_global_io (SGIO *io)|
|SGIO * ||get_global_io ()|
|void ||set_global_parallel (Parallel *parallel)|
|Parallel * ||get_global_parallel ()|
|void ||set_global_version (Version *version)|
|Version * ||get_global_version ()|
|SGStringList< char > ||get_modelsel_names ()|
|void ||print_modsel_params ()|
|char * ||get_modsel_param_descr (const char *param_name)|
|index_t ||get_modsel_param_index (const char *param_name)|
|void ||build_gradient_parameter_dictionary (CMap< TParameter *, CSGObject * > *dict)|
|virtual void ||update_parameter_hash ()|
|virtual bool ||parameter_hash_changed ()|
|virtual bool ||equals (CSGObject *other, float64_t accuracy=0.0, bool tolerant=false)|
|virtual CSGObject * ||clone ()|
computes a p-value based on current method for approximating the null-distribution. The p-value is the 1-p quantile of the null- distribution where the given statistic lies in. This method depends on the implementation of sample_null method which should be implemented in its sub-classes
|statistic||statistic value to compute the p-value for |
- p-value parameter statistic is the (1-p) percentile of the null distribution
Reimplemented in CQuadraticTimeMMD, CNOCCO, CStreamingMMD, CHSIC, and CTwoSampleTest.
Definition at line 71 of file HypothesisTest.cpp.
computes a threshold based on current method for approximating the null-distribution. The threshold is the value that a statistic has to have in ordner to reject the null-hypothesis. This method depends on the implementation of sample_null method which should be implemented in its sub-classes
|alpha||test level to reject null-hypothesis |
- threshold for statistics to reject null-hypothesis
Reimplemented in CQuadraticTimeMMD, CStreamingMMD, CNOCCO, CHSIC, and CTwoSampleTest.
Definition at line 93 of file HypothesisTest.cpp.
creates a new TParameter instance, which contains migrated data from the version that is provided. The provided parameter data base is used for migration, this base is a collection of all parameter data of the previous version. Migration is done FROM the data in param_base TO the provided param info Migration is always one version step. Method has to be implemented in subclasses, if no match is found, base method has to be called.
If there is an element in the param_base which equals the target, a copy of the element is returned. This represents the case when nothing has changed and therefore, the migrate method is not overloaded in a subclass
|param_base||set of TParameter instances to use for migration |
|target||parameter info for the resulting TParameter |
- a new TParameter instance with migrated data from the base of the type which is specified by the target parameter
Definition at line 949 of file SGObject.cpp.
Performs the complete two-sample test on current data and returns a p-value.
This is a wrapper that calls compute_statistic first and then calls compute_p_value using the obtained statistic. In some statistic classes, it might be possible to compute statistic and p-value in one single run which is more efficient. Therefore, this method might be overwritten in subclasses.
The method for computing the p-value can be set via set_null_approximation_method().
- p-value such that computed statistic is the (1-p) quantile of the estimated null distribution
Reimplemented in CStreamingMMD.
Definition at line 112 of file HypothesisTest.cpp.
Performs the complete two-sample test on current data and returns a binary answer wheter null hypothesis is rejected or not.
This is just a wrapper for the above perform_test() method that returns a p-value. If this p-value lies below the test level alpha, the null hypothesis is rejected.
Should not be overwritten in subclasses. (Therefore not virtual)
- true if null hypothesis is rejected and false otherwise
Definition at line 120 of file HypothesisTest.cpp.