ihygecdf

ihygecdf

The ihygecdf function calculates the inverse hypergeometric cumulative distribution (CDF).

Synopsis

ihygecdf(cumulative_probability, successes, failures, trials)

Summary


The inverse hypergeometric cumulative distribution function returns the maximum number of expected successful events, given the following parameters:

  • cumulative_probability – the cumulative probability of the event occurring

  • successes  the total number of possible successes

  • failures  the total number of possible failures

  • trials  the number of times the experiment is repeated without replacement

Example

In a batch of 100 marbles, 20 marbles are white and 80 are black. Find the probability of drawing between 0 and x white marbles in a batch of 10 randomly selected marbles using the hypergeometric CDF.
 

  1. Create a matrix to hold the number of successes (x):

    AFL% store(build(<success:double>[x=0:9], double(x)), success_array);
  2. Apply the cumulative probability of x or fewer successes computed using the direct hypergeometric CDF, and store in prob_array:

    AFL% store(apply(success_array, prob, hygecdf(success,20,80,10)), prob_array);


    The output is:

    {x} success,prob {0} 0,0.0951163 {1} 1,0.363049 {2} 2,0.68122 {3} 3,0.890428 {4} 4,0.974535 {5} 5,0.996067 {6} 6,0.999608 {7} 7,0.999976 {8} 8,0.999999 {9} 9,1
  3. Apply the inverse hypergeometric CDF to the probabilities in prob_array:

    AFL% apply(prob_array, inverse, ihygecdf(prob,20,80,10));


    The output is:

    {x} success,prob,inverse {0} 0,0.0951163,0 {1} 1,0.363049,1 {2} 2,0.68122,2 {3} 3,0.890428,3 {4} 4,0.974535,4 {5} 5,0.996067,5 {6} 6,0.999608,6 {7} 7,0.999976,7 {8} 8,0.999999,8 {9} 9,1,9
  4. Remove the example arrays:

    AFL% remove(success_array); remove(prob_array);