| 362 | /*! More details on: http://en.wikipedia.org/wiki/Student's_t-test */ |
| 363 | template <typename ValueType> |
| 364 | double TTest(ValueType diffValue, ValueType diffPrecision, const bool isTailed = false, const bool isLeftTailed = true) { |
| 365 | static const ValueType EPS = 16 * std::numeric_limits<ValueType>::epsilon(); |
| 366 | |
| 367 | if (diffPrecision < EPS) { |
| 368 | if (std::abs(diffValue) > EPS) { |
| 369 | return 1.0; |
| 370 | } else { |
| 371 | return 0.5; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | if (isTailed) { |
| 376 | const double res = Phi(static_cast<ValueType>(0.0), diffPrecision, diffValue, false); |
| 377 | return isLeftTailed ? res : (1 - res); |
| 378 | } else { |
| 379 | const double res = Phi(static_cast<ValueType>(0.0), diffPrecision, std::abs(diffValue), false); |
| 380 | return (1 - res) * 2; |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | template <typename InputIterator, typename ValueType> |
| 385 | double TTest(InputIterator begin, InputIterator end, ValueType expectedMean, |