| 133 | //! Wilcoxon test for two samples. |
| 134 | template <typename InputIterator1, typename InputIterator2> |
| 135 | TStatTestResult WilcoxonWithSign(InputIterator1 xBegin, InputIterator1 xEnd, InputIterator2 yBegin, InputIterator2 yEnd) { |
| 136 | typedef typename std::iterator_traits<InputIterator1>::value_type ValueType; |
| 137 | typedef typename std::iterator_traits<InputIterator2>::value_type AnotherValueType; |
| 138 | static_assert((std::is_same<ValueType, AnotherValueType>::value), "expect (std::is_same<ValueType, AnotherValueType>::value)"); |
| 139 | static_assert(std::is_floating_point<ValueType>::value, "expect std::is_floating_point<ValueType>::value"); |
| 140 | |
| 141 | if (std::distance(xBegin, xEnd) != std::distance(yBegin, yEnd) || xBegin == xEnd) { |
| 142 | return TStatTestResult(0.5, 0); |
| 143 | } |
| 144 | |
| 145 | TVector<ValueType> v; |
| 146 | for (; xBegin != xEnd; ++xBegin, ++yBegin) { |
| 147 | if (!NDetail::RelativeEqual(*xBegin, *yBegin)) { |
| 148 | v.push_back(*xBegin - *yBegin); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | Sort(v.begin(), v.end(), NDetail::WilcoxonComparator<ValueType>); |
| 153 | return NDetail::WilcoxonTestWithSign(v.begin(), v.end()); |
| 154 | } |
| 155 | |
| 156 | //! Wilcoxon test for two samples. |
| 157 | template <typename InputIterator1, typename InputIterator2> |
no test coverage detected