yat
0.20.3pre
|
Kolmogorov Smirnov Test. More...
#include <yat/statistics/KolmogorovSmirnov.h>
Classes | |
struct | Element |
Public Member Functions | |
KolmogorovSmirnov (void) | |
Constructor. | |
void | add (double value, bool class_label, double weight=1.0) |
add a value | |
template<typename ForwardIterator > | |
void | add (ForwardIterator first, ForwardIterator last) |
add a range More... | |
double | p_value (void) const |
Large-Sample Approximation. More... | |
double | p_value (size_t perm) const |
p-value More... | |
void | remove (double value, bool class_label, double weight=1.0) |
Remove a data point. More... | |
void | reset (void) |
resets everything to zero | |
double | score (void) const |
Kolmogorov Smirnov statistic. More... | |
void | shuffle (void) |
shuffle class labels More... | |
double | signed_score (void) const |
Friends | |
std::ostream & | operator<< (std::ostream &, const KolmogorovSmirnov &) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &, const KolmogorovSmirnov &) |
output operator | |
Kolmogorov Smirnov Test.
void theplu::yat::statistics::KolmogorovSmirnov::add | ( | ForwardIterator | first, |
ForwardIterator | last | ||
) |
add a range
Type Requirements:
ForwardIterator
models Readable IteratorForwardIterator
models Forward Traversal Iteratorvalue_type
of ForwardIterator
must be convertible to KolmogorovSmirnov::Element
Insertion takes typically N*log(N). However, if range is sorted, insertion takes linear time. A common use case of this function is when calculating several KS statistics on a data set (values and weights) with different class labels.
double theplu::yat::statistics::KolmogorovSmirnov::p_value | ( | void | ) | const |
Large-Sample Approximation.
This analytical approximation of p-value can be used when all weight equal unity and sample sizes n and m are large. The p-value is calcuated as , where s is the scaled score:
Following Hollander and Wolfe
double theplu::yat::statistics::KolmogorovSmirnov::p_value | ( | size_t | perm | ) | const |
void theplu::yat::statistics::KolmogorovSmirnov::remove | ( | double | value, |
bool | class_label, | ||
double | weight = 1.0 |
||
) |
Remove a data point.
utility::runtime_error | if no data point exist with value, class_label, and weight. |
double theplu::yat::statistics::KolmogorovSmirnov::score | ( | void | ) | const |
Kolmogorov Smirnov statistic.
where
void theplu::yat::statistics::KolmogorovSmirnov::shuffle | ( | void | ) |
shuffle class labels
This is equivalent to reset and re-add values with shuffled class labels.
double theplu::yat::statistics::KolmogorovSmirnov::signed_score | ( | void | ) | const |