Changeset 3002 for trunk/yat/statistics/KolmogorovSmirnovOneSample.cc
- Timestamp:
- Mar 20, 2013, 11:02:44 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/KolmogorovSmirnovOneSample.cc
r2998 r3002 115 115 iterator iter = data_.begin(); 116 116 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. 117 121 while (iter != data_.end()) { 118 122 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; 119 127 while (iter!=data_.end() && iter->first==x) { 120 128 w += iter->second; 121 129 ++iter; 122 130 } 123 double s = w / sum_w_ - x; 131 // calculate |F(x) - x| 132 s = w / sum_w_ - x; 124 133 if (std::abs(s) > std::abs(score_)) 125 134 score_ = s;
Note: See TracChangeset
for help on using the changeset viewer.