yat
0.14.5pre
|
Spearman rank correlation coefficient. More...
#include <yat/statistics/Spearman.h>
Public Member Functions | |
Spearman (void) | |
Constructor. | |
virtual | ~Spearman (void) |
Destructor. | |
void | add (double x, double y) |
add pair of data | |
size_t | n (void) const |
Number of data points. More... | |
double | p_left (bool exact=false) const |
Lower one-sided p-value. More... | |
double | p_right (bool exact=false) const |
Upper one-sided p-value. More... | |
double | p_value (bool exact=false) const |
Two-sided p-value. More... | |
void | reset (void) |
reset to empty | |
double | score (void) const |
spearman rank correlation coefficient More... | |
Spearman rank correlation coefficient.
Class for Spearman rank correlation coefficient which can be understood as Pearson correlation of ranks.
size_t theplu::yat::statistics::Spearman::n | ( | void | ) | const |
Number of data points.
double theplu::yat::statistics::Spearman::p_left | ( | bool | exact = false | ) | const |
double theplu::yat::statistics::Spearman::p_right | ( | bool | exact = false | ) | const |
Upper one-sided p-value.
Calculates, , the probability to get a score greater (or equal) than score() given that there is no association between two variables.
In exact mode the score is calculated for each permutation and compared to the actual score. In each permutation one variable, say x, is kept fix while the other (y) is shuffled in determionsitic fashion. Number of permutations grows quickly as number of data points grows and with no ties there are N! permutations and the exact method gets very expensive.
In approximative mode P-value is calculated using pearson_p_value().
double theplu::yat::statistics::Spearman::p_value | ( | bool | exact = false | ) | const |
double theplu::yat::statistics::Spearman::score | ( | void | ) | const |
spearman rank correlation coefficient
The Spearman rank correlation coeeficient is defined as where and are ranks of X and Y, respectively. In case of ties, the rank is defined as the average rank of the ties.