Evaluates the hypergeometric cumulative density function.

You're viewing an older version of this page (#5445). View the current version.

View versions (2)

Interface

#include <codecogs/statistics/distributions/discrete/hypergeometric/cdf.h>

using namespace Statistics::Distributions::Discrete::Hypergeometric;

This function evaluates the hypergeometric cumulative density function.

\graph x=1:8:8 a=17 b=9 n=8

Example 1

#include <iostream>
#include <codecogs/statistics/distributions/discrete/hypergeometric/cdf.h>

int main()
{
  std::cout << "hypergeometric CDF (6, 17, 9, 8) = ";
  std::cout << Statistics::Distributions::Discrete::Hypergeometric::CDF(6, 17, 9, 8) << std::endl;
  return 0;
}

Output:

hypergeometric CDF (6, 17, 9, 8) = 0.872403

Parameters

x
the maximum number of type-A items drawn (upper limit of the cumulative sum), 0 <= x <= n
a
the number of type-A items in the population
b
the number of type-B items in the population
n
the sample size (number of items drawn from the population, without replacement)

Returns

the cumulative probability P(X <= x) that at most x of the n items drawn are type-A
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
a
b
n
Result