Subject: [Boost-bugs] [Boost C++ Libraries] #5095: incorrect results from hypergeometric pdf
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-19 17:06:00
#5095: incorrect results from hypergeometric pdf
-----------------------------------------+----------------------------------
Reporter: David Koes <dkoes@â¦> | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
Version: Boost 1.45.0 | Severity: Problem
Keywords: |
-----------------------------------------+----------------------------------
#include <boost/math/distributions/hypergeometric.hpp>
#include <boost/math/policies/policy.hpp>
#include <iostream>
using namespace std;
using namespace boost;
int main()
{
unsigned N = 16086184;
unsigned n = 256004;
unsigned Q = 251138;
math::hypergeometric_distribution<double> hyper(n, Q, N);
cout << math::pdf<double>(hyper, 4000) << " " <<
math::pdf<double>(hyper, 4001) << " " << math::pdf<double>(hyper, 4002)
<< "\n";
return 0;
}
Output:
0.00640003 1.11519e-09 0.00638443
The value for 4001 is incorrect (according to
http://stattrek.com/Tables/Hypergeometric.aspx). In fact, every value
where k is odd appears to be incorrect.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5095> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC