wdm::Indep_test Class Reference
#include <wdm.hpp>
Public Member Functions | |
| Indep_test (std::vector< double > x, std::vector< double > y, std::string method, std::vector< double > weights=std::vector< double >(), bool remove_missing=true, std::string alternative="two-sided", std::vector< int > seeds=std::vector< int >(), bool y_continuous=true) | |
| std::string | method () const |
| Returns the requested method name. | |
| std::string | alternative () const |
| Returns the requested alternative hypothesis. | |
| double | n_eff () const |
| Returns Kish's effective sample size after missing-value removal. | |
| double | estimate () const |
| Returns the estimated dependence measure. | |
| double | statistic () const |
| Returns the method-specific transformed test statistic. | |
| double | p_value () const |
| Returns the asymptotic p-value. | |
Detailed Description
Asymptotic independence test based on a dependence measure.
The test stores the estimate, transformed test statistic, effective sample size, and p-value. Weighted transformations use Kish's effective sample size. The approximation must have enough effective observations for the selected method.
Available methods:
"pearson","prho","cor": Pearson correlation"spearman","srho","rho": Spearman's \( \rho \)"kendall","ktau","tau": Kendall's \( \tau \)"blomqvist","bbeta","beta": Blomqvist's \( \beta \)"hoeffding","hoeffd","d": Hoeffding's \( D \)"chatterjee","cxi","xi": Chatterjee's \( \xi \)
Hoeffding's D supports only the two-sided alternative. Other methods support "two-sided", "less", and "greater".
- Note
- Weighted analytic inference for Chatterjee's xi assumes that the weights are fixed or depend only on
x, the normalized weights are diffuse, andyis continuous. The weighted estimate remains available whenyis tied, but analytic inference with unequal weights does not. For a continuous response,estimate()reports the general denominator-corrected coefficient whilestatistic()standardizes the analytically covered approximation \(1 - 3 A\).
Constructor & Destructor Documentation
◆ Indep_test()
|
inline |
Constructs and evaluates an independence test.
- Parameters
-
x,y input vectors of equal length. method the dependence measure; see class details for possible values. weights optional finite, nonnegative case weights with positive total weight. remove_missing if true, rows containing aNaNare removed; otherwise aNaNraises an exception.alternative indicates the alternative hypothesis and must be one of "two-sided","greater"or"less";"greater"corresponds to positive association,"less"to negative association. For Hoeffding's \( D \), only"two-sided"is allowed. The natural one-sided alternative for Chatterjee's xi is"greater".seeds optional seeds for random Chatterjee predictor-tie breaking. y_continuous whether the Chatterjee response distribution is known to be continuous. Set this to falsefor a discrete response even if the sample has no observed response ties. Observed ties always override this value.
- Exceptions
-
std::runtime_error for invalid inputs, method or alternative names, unsupported Hoeffding alternatives, or unavailable weighted Chatterjee inference for a discrete or tied response.
The documentation for this class was generated from the following file:
- include/wdm.hpp
1.9.1