Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface for the cumulative distribution function (CDF) of a hypergeometric distribution.

Hierarchy

  • CDF

Callable

  • __call(x: number, N: number, K: number, n: number): number
  • Evaluates the cumulative distribution function (CDF) for a hypergeometric distribution with population size N, subpopulation size K, and number of draws n at a value x.

    Notes

    • If provided a population size N, subpopulation size K or draws n which is not a nonnegative integer, the function returns NaN.
    • If the number of draws n or subpopulation size K exceeds population size N, the function returns NaN.

    Parameters

    • x: number

      input value

    • N: number

      population size

    • K: number

      subpopulation size

    • n: number

      number of draws

    Returns number

    evaluated CDF

    Example

    var y = cdf( 1.0, 8, 4, 2 );
    // returns ~0.786

    Example

    var y = cdf( 1.5, 8, 4, 2 );
    // returns ~0.786

    Example

    var y = cdf( 2.0, 8, 4, 2 );
    // returns 1.0

    Example

    var y = cdf( 0, 8, 4, 2 );
    // returns ~0.214

    Example

    var y = cdf( NaN, 10, 5, 2 );
    // returns NaN

    Example

    var y = cdf( 0.0, NaN, 5, 2 );
    // returns NaN

    Example

    var y = cdf( 0.0, 10, NaN, 2 );
    // returns NaN

    Example

    var y = cdf( 0.0, 10, 5, NaN );
    // returns NaN

    Example

    var y = cdf( 2.0, 10.5, 5, 2 );
    // returns NaN

    Example

    var y = cdf( 2.0, 10, 1.5, 2 );
    // returns NaN

    Example

    var y = cdf( 2.0, 10, 5, -2.0 );
    // returns NaN

    Example

    var y = cdf( 2.0, 10, 5, 12 );
    // returns NaN

    Example

    var y = cdf( 2.0, 8, 3, 9 );
    // returns NaN

Index

Methods

Methods

factory

  • factory(N: number, K: number, n: number): Unary
  • Returns a function for evaluating the cumulative distribution function (CDF) for a hypergeometric distribution with population size N, subpopulation size K, and number of draws n.

    Parameters

    • N: number

      population size

    • K: number

      subpopulation size

    • n: number

      number of draws

    Returns Unary

    CDF

    Example

    var mycdf = cdf.factory( 30, 20, 5 );
    var y = mycdf( 4.0 );
    // returns ~0.891
    
    y = mycdf( 1.0 );
    // returns ~0.031