Changeset 3002


Ignore:
Timestamp:
Mar 20, 2013, 11:02:44 AM (9 years ago)
Author:
Peter
Message:

closes #686

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/KolmogorovSmirnovOneSample.cc

    r2998 r3002  
    115115    iterator iter = data_.begin();
    116116    double w = 0;
     117    // Finding the max value of |F(x)-x|, where F(x) is empirical
     118    // cumulative distribution. Since F is stepwise constant and
     119    // right-continuous by definition we only need to look at the end
     120    // of every step, i.e., at x_i and x_i - dx.
    117121    while (iter != data_.end()) {
    118122      double x = iter->first;
     123      // calculate |F(x-dx) - (x-dx)|
     124      double s = w / sum_w_ - x;
     125      if (std::abs(s) > std::abs(score_))
     126        score_ = s;
    119127      while (iter!=data_.end() && iter->first==x) {
    120128        w += iter->second;
    121129        ++iter;
    122130      }
    123       double s = w / sum_w_ - x;
     131      // calculate |F(x) - x|
     132      s = w / sum_w_ - x;
    124133      if (std::abs(s) > std::abs(score_))
    125134        score_ = s;
Note: See TracChangeset for help on using the changeset viewer.