FUNCTION
Evaluates the hypergeometric probability density function.
Interface
#include <codecogs/statistics/distributions/discrete/hypergeometric/pdf.h>
using namespace Statistics::Distributions::Discrete::Hypergeometric;
This function evaluates the hypergeometric probability density function.
$$P(x) = \frac{\left ( \begin{array}{c}a\\x \end{array} \right ) \left ( \begin{array}{c}b\\n-x \end{array} \right )}{\left ( \begin{array}{c}a+b\\n \end{array} \right )}$$
(1)
Example 1
#include <iostream>
#include <codecogs/statistics/distributions/discrete/hypergeometric/pdf.h>
int main()
{
std::cout << "hypergeometric PDF (5, 10, 20, 8) = ";
std::cout << Statistics::Distributions::Discrete::Hypergeometric::PDF(5, 10, 20, 8) << std::endl;
return 0;
}Output:
hypergeometric PDF (5, 10, 20, 8) = 0.0490832Parameters
x
the number of successes drawn, 0 <= x <= min(a,n)
a
the number of success items in the population
b
the number of failure items in the population
n
the number of items drawn (the sample size), n <= a+b
Interactive Calculator
x
a
b
n
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.